Phase difference detector and rotation angle detection device including the same

ABSTRACT

In a phase difference detector, a first phase difference computation unit computes a value of E(i)·C corresponding to one and the same given magnetic pole sensed by the two magnetic sensors with use of six output signals sampled at three different timings while the two magnetic sensors are sensing the given magnetic pole when a rotary body is rotating. E is an angular width error correction value, and C is a phase difference between two signals. The first phase difference computation unit executes this process until values of E(i)·C corresponding to all the magnetic poles are computed. After that, the first phase difference computation unit computes the phase difference between the output signals with use of the values of E(i)·C corresponding to all the magnetic poles and the number (m) of the magnetic poles.

INCORPORATION BY REFERENCE

The disclosure of Japanese Patent Application No. 2012-271639 filed onDec. 12, 2012 including the specification, drawings and abstract isincorporated herein by reference in its entirety.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The invention relates to a phase difference detector that detects aphase difference between output signals from two magnetic sensors, and arotation angle detection device including the phase difference detector.

2. Description of the Related Art

As a rotation angle detection device that detects a rotation angle of arotary body, there has been known a rotation angle detection device thatdetects a rotation angle of a rotor of a brush-less motor with the useof a detection rotor that rotates in accordance with the rotation of thebrushless motor. Specifically, as illustrated in FIG. 16, a detectionrotor 201 (hereinafter, referred to as “rotor 201”) includes acylindrical magnet 202 having a plurality of magnetic pole pairscorresponding to magnetic pole pairs formed in a rotor of a brushlessmotor. Two magnetic sensors 221, 222 are arranged around the rotor 201at a predetermined angular interval around the rotation central axis ofthe rotor 201. The magnetic sensors 221, 222 respectively outputsinusoidal signals having a predetermined phase difference. On the basisof the two sinusoidal signals, a rotation angle of the rotor 201 (arotation angle of the brushless motor) is detected.

In this example, the magnet 202 has five magnetic pole pairs. That is,the magnet 202 has ten magnetic poles arranged at equal angularintervals. The magnetic poles are arranged at angular intervals of 36°(180° in electrical angle) around the rotation central axis of the rotor201. Further, the two magnetic sensors 221, 222 are arranged at anangular interval of 18° (90° in electrical angle) around the rotationcentral axis of the rotor 201.

The direction indicated by an arrow in FIG. 16 is defined as the forwardrotation direction of the detection rotor 201. The rotation angle of therotor 201 increases as the rotor 201 is rotated in the forwarddirection, whereas the rotation angle of the rotor 201 decreases as therotor 201 is rotated in the reverse direction. The magnetic sensors 221,222 output sinusoidal signals S₁, S₂, respectively. As illustrated inFIG. 17, one period of each of the sinusoidal signals S₁, S₂ correspondsto a duration in which the rotor 201 rotates an angle of 72° (360° inelectrical angle) corresponding to one magnetic pole pair.

The angular range corresponding to one rotation of the rotor 201 isdivided into five sections corresponding to the five magnetic polepairs, a start position of each section is defined as 0°, and an endposition of each section is defined as 360°. A rotation angle of therotor 201 expressed under the above-described conditions is anelectrical angle θ of the rotor 201. In this case, the first magneticsensor 221 outputs an output signal of S₁=A₁·sin θ, and the secondmagnetic sensor 222 outputs an output signal of S₂=A₂·cos θ. Each of A₁and A₂ represents an amplitude. If the amplitude A₁ of the output signalS₁ and the amplitude A₂ of the output signal S₂ are assumed to be equalto each other, the electrical angle θ of the rotor 201 is obtained withthe use of both the output signals S₁, S₂ based on the followingexpression.

$\begin{matrix}{\theta = {\tan^{- 1}\left( {\sin\;{\theta/\cos}\;\theta} \right)}} \\{= {\tan^{- 1}\left( {S_{1}/S_{2}} \right)}}\end{matrix}$

The thus obtained electrical angle θ is used to control the brushlessmotor. Refer to, for example, Japanese Patent Application PublicationNo. 2008-26297 (JP 2008-26297 A).

In the above-described conventional rotation angle detection device, therotation angle θ is computed on the assumption that the amplitudes A₁,A₂ of the output signals S₁, S₂ output from the magnetic sensors 221,222 are equal to each other. However, the amplitudes A₁, A₂ of theoutput signals S₁, S₂ vary depending on variations of the temperaturecharacteristics of the magnetic sensors 221, 222 and temperaturechanges. Therefore, an error may be caused in detection of a rotationangle of the rotor due to variations of the temperature characteristicsof the magnetic sensors 221, 222 and temperature changes.

The inventors et al. developed a rotation angle detection device thatdetects a rotation angle of a rotary body such as a steering shaft, therotation angle detection device including: two magnetic sensors thatrespectively output sinusoidal signals having a phase difference inaccordance with rotation of the rotary body; and a computation unit thatcomputes a rotation angle of the rotary body on the basis of a pluralityof output signals from the magnetic sensors, which are sampled atdifferent sampling timings. The computation unit is formed of, forexample, an electronic control unit (ECU) including a computer.

The phase difference between the output signals from the two magneticsensors exerts a significant influence on the rotation angle computationaccuracy, and hence the phase difference needs to be accuratelymeasured. Therefore, before factory shipment of the ECU, the phasedifference between the output signals from the two magnetic sensors maybe accurately measured and stored in a nonvolatile memory in the ECU. Inorder to accurately measure the phase difference, there may be employeda method in which waveforms of the output signals from the two magneticsensors are monitored while the rotary body is rotated at a uniformvelocity, and the phase difference is measured on the basis of theobtained waveforms and the rotation speed of the rotary body. However,in order to measure the phase difference according to such a method, aspecial device for rotating the rotary body at a uniform velocity isrequired.

If a failure or the like has occurred in the ECU and the ECU isreplaced, the phase difference between the output signals from the twomagnetic sensors is unknown. Therefore, the phase difference needs to benewly measured. However, in order to accurately measure the phasedifference between the output signals from the two magnetic sensors, aspecial device for rotating the rotary body at a uniform velocity isrequired. Therefore, the phase difference cannot be easily measured.

SUMMARY OF THE INVENTION

One object of the invention is to provide a phase difference detectorcapable of easily detecting a phase difference between output signalsfrom two magnetic sensors without using a special device, and a rotationangle detection device including the phase difference detector.

A phase difference detector according to an aspect of the inventionincludes: a multipolar magnet that rotates in accordance with rotationof a rotary body, and that has a plurality of magnetic poles; twomagnetic sensors that are a first magnetic sensor and a second magneticsensor, and that respectively output sinusoidal signals having apredetermined phase difference in accordance with rotation of themultipolar magnet; and a phase difference computation unit that computesthe phase difference with use of the output signals from the twomagnetic sensors. Where an output signal S₁ from the first magneticsensor is expressed by S₁=A₁ sin(E₁θ) in which A₁ is an amplitude of theoutput signal S₁, E₁ is a magnetic pole width error correction value forthe magnetic pole sensed by the first magnetic sensor, and θ is arotation angle of the rotary body, an output signal S₂ from the secondmagnetic sensor is expressed by S₂=A₂ sin(E₂θ+C) in which A₂ is anamplitude of the output signal S₂, E₂ is a magnetic pole width errorcorrection value for the magnetic pole sensed by the second magneticsensor, and C is a phase difference between the output signal S₂ fromthe second magnetic sensor and the output signal S₁ from the firstmagnetic sensor, m is the number of the magnetic poles of the multipolarmagnet, i is a natural number from 1 to m, which is used to relativelyidentify each of the magnetic poles, and E(i) is a magnetic pole widtherror correction value corresponding to each of the magnetic poles, thephase difference computation unit includes a first computation unit thatexecutes a process of computing a value of E(i)·C corresponding to oneand the same given magnetic pole sensed by the two magnetic sensors withuse of six output signals that are sampled at three different timingswhile the two magnetic sensors are sensing the given magnetic pole whenthe rotary body is rotating, until values of E(i)·C corresponding to allthe magnetic poles are computed, and a second computation unit thatcomputes the phase difference C with use of the values of E(i)·Ccorresponding to all the magnetic poles computed by the firstcomputation unit and the number m of the magnetic poles of themultipolar magnet.

In the above-described aspect, it is possible to automatically computethe phase difference between the output signals from the two magneticsensors by rotating the rotary body. At this time, it is not necessaryto rotate the rotary body at a uniform velocity. Therefore, it ispossible easily detect the phase difference without using a specialdevice.

A rotation angle detection device according to another aspect of theinvention includes: the phase difference detector according to theabove-described aspect; and a rotation angle computation unit thatcomputes a rotation angle of the rotary body with use of four outputsignals from the two magnetic sensors, the four output signals beingsampled at two different timings, and the phase difference C detected bythe phase difference detector.

In this aspect, the rotation angle of the rotary body is computed withuse of the four output signals from the two magnetic sensors, the fouroutput signals being sampled at two different timings, and the phasedifference C detected by the phase difference detector. Therefore, it ispossible to detect the rotation angle with a higher degree of accuracythan that in the above-described conventional technique.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing and further features and advantages of the invention willbecome apparent from the following description of example embodimentswith reference to the accompanying drawings, wherein like numerals areused to represent like elements and wherein:

FIG. 1 is a schematic view illustrating the schematic configuration ofan electric power steering system to which a rotation angle detectiondevice according to an embodiment of the invention is applied;

FIG. 2 is a schematic diagram illustrating the electrical configurationof a motor control ECU;

FIG. 3 is a schematic diagram schematically illustrating theconfiguration of an electric motor;

FIG. 4 is a graph illustrating an example of a manner of setting aq-axis current command value I_(q)* with respect to a detected steeringtorque Th;

FIG. 5 is a schematic view schematically illustrating the configurationof a torque sensor;

FIG. 6 is a schematic diagram illustrating the configuration of a firstmagnet and the arrangement of two magnetic sensors;

FIG. 7 is a schematic diagram illustrating waveforms of output signalsfrom a first magnetic sensor and a second magnetic sensor;

FIG. 8 is a flowchart showing the operation of a first rotation anglecomputation unit;

FIG. 9 is a flowchart showing the procedure of a rotation anglecomputing process based on forced rotation in step S1 in FIG. 8;

FIG. 10 is a flowchart showing the procedure of a normal rotation anglecomputing process in step S2 in FIG. 8;

FIG. 11A is a flowchart showing a part of the procedure of a phasedifference computing process executed by a first phase differencecomputation unit;

FIG. 11B is a flowchart showing the remaining part of the procedure of aphase difference computing process executed by a first phase differencecomputation unit;

FIG. 12 is a schematic diagram illustrating part of contents of a memoryin a torque computation ECU;

FIG. 13 is a flowchart showing the detailed procedure of a relative polenumber setting process;

FIG. 14A is a schematic diagram illustrating the relative pole numbersetting process;

FIG. 14B is a schematic diagram illustrating the relative pole numbersetting process;

FIG. 15A is a flowchart showing a part of the procedure of a phasedifference computing process executed by the first phase differencecomputation unit;

FIG. 15B is a flowchart showing the remaining part of the procedure ofthe phase difference computing process executed by the first phasedifference computation unit;

FIG. 16 is a schematic diagram illustrating a rotation angle detectionmethod executed by a conventional rotation angle detection device; and

FIG. 17 is a schematic diagram illustrating waveforms of output signalsfrom a first magnetic sensor and a second magnetic sensor.

DETAILED DESCRIPTION OF EMBODIMENTS

Hereinafter, embodiments of the invention will be described withreference to the accompanying drawings. As illustrated in FIG. 1, anelectric power steering system 1 includes a steering wheel 2, whichserves as a steering member used to steer a vehicle, a steered mechanism4 that steers steered wheels 3 in accordance with the rotation of thesteering wheel 2, and a steering assist mechanism 5 used to assist adriver in performing a steering operation. The steering wheel 2 and thesteered mechanism 4 are mechanically connected to each other via asteering shaft 6 and an intermediate shaft 7.

The steering shaft 6 includes an input shaft 8 connected to the steeringwheel 2 and an output shaft 9 connected to the intermediate shaft 7. Theinput shaft 8 and the output shaft 9 are connected to each other via atorsion bar 10 so as to be rotatable relative to each other on the sameaxis. That is, when the steering wheel 2 is rotated, the input shaft 8and the output shaft 9 rotate in the same direction while rotatingrelative to each other.

A torque sensor (torque detection device) 11, to which a phasedifference detector according to an embodiment of the invention isapplied, is arranged around the steering shaft 6. The torque sensor 11detects a steering torque applied to the steering wheel 2 on the basisof a relative rotational displacement between the input shaft 8 and theoutput shaft 9. The steering torque detected by the torque sensor 11 isinput into an electronic control unit 12 for motor control (hereinafter,referred to as “motor control ECU 12”).

The steered mechanism 4 is formed of a rack-and-pinion mechanismincluding a pinion shaft 13 and a rack shaft 14 that serves as a steeredshaft. The steered wheels 3 are connected to respective end portions ofthe rack shaft 14 via tie rods 15 and knuckle arms (not illustrated).The pinion shaft 13 is connected to the intermediate shaft 7. The pinionshaft 13 rotates in accordance with steering of the steering wheel 2. Apinion 16 is connected to a distal end of the pinion shaft 13.

The rack shaft 14 linearly extends along the lateral direction of thevehicle (the direction orthogonal to the direction in which the vehicletravels straight ahead). A rack 17 that meshes with the pinion 16 isformed at an axially intermediate portion of the rack shaft 14. Thepinion 16 and the rack 17 convert the rotation of the pinion shaft 13into an axial movement of the rack shaft 14. By moving the rack shaft 14in the axial direction, the steered wheels 3 are steered.

When the steering wheel 2 is steered (rotated), the rotation istransmitted to the pinion shaft 13 via the steering shaft 6 and theintermediate shaft 7. The rotation of the pinion shaft 13 is convertedinto an axial movement of the rack shaft 14 by the pinion 16 and therack 17. As a result, the steered wheels 3 are steered. The steeringassist mechanism 5 includes an electric motor 18 that generates steeringassist force and a speed-reduction mechanism 19 that transmits torqueoutput from the electric motor 18 to the steered mechanism 4. Theelectric motor 18 is formed of a three-phase brushless motor in thepresent embodiment. The speed-reduction mechanism 19 is formed of s wormgear mechanism including a worm shaft 20 and a worm wheel 21 that mesheswith the worm shaft 20. The speed-reduction mechanism 19 is housed in agear housing 22 that serves as a transmission mechanism housing.

The worm shaft 20 is driven to be rotated by the electric motor 18. Theworm wheel 21 is connected to the steering shaft 6 so as to be rotatablein the same direction as the rotation direction of the steering shaft 6.The worm wheel 21 is driven to be rotated by the worm shaft 20. When theworm shaft 20 is driven to be rotated by the electric motor 18, the wormwheel 21 is driven to be rotated, and the steering shaft 6 rotates. Therotation of the steering shaft 6 is transmitted to the pinion shaft 13via the intermediate shaft 7. The rotation of the pinion shaft 13 isconverted into an axial movement of the rack shaft 14. As a result, thesteered wheels 3 are steered. That is, when the worm shaft 20 is drivento be rotated by the electric motor 18, the steered wheels 3 aresteered.

A rotation angle of a rotor of the electric motor 18 (a rotor rotationangle) is detected by a rotation angle sensor 25 such as a resolver. Asignal output from the rotation angle sensor 25 is input into the motorcontrol ECU 12. The electric motor 18 is controlled by the motor controlECU 12 that serves as a motor control unit. FIG. 2 is a schematicdiagram illustrating the electrical configuration of the motor controlECU 12.

The motor control ECU 12 realizes appropriate steering assistance suitedto a steering state, by driving the electric motor 18 on the basis of asteering torque Th detected by the torque sensor 11. The motor controlECU 12 includes a microcomputer 40, a drive circuit (inverter circuit)31 that is controlled by the microcomputer 40 and that supplies electricpower to the electric motor 18, and a current detection unit 32 thatdetects a motor current passing through the electric motor 18.

The electric motor 18 is, for example, a three-phase brushless motor,and includes a rotor 100, which serves as a field magnet, and a stator105 provided with U-phase, V-phase, and W-phase stator coils 101, 102,103, as illustrated in FIG. 3. The electric motor 18 may be an electricmotor of an inner rotor type, in which a stator is arranged outside arotor so as to face the rotor, or may be an electric motor of an outerrotor type, in which a stator is arranged inside a tubular rotor so asto face the rotor.

A UVW coordinate system that is a three-phase fixed coordinate system isdefined, in which a U-axis, a V-axis, and a W-axis are set to therespective directions of the U-phase stator coil 101, the V-phase statorcoil 102 and the W-phase stator coil 13. A dq coordinate system (anactual rotating coordinate system) that is a two-phase rotatingcoordinate system is defined, in which a d-axis that is a magnetic poleaxis is set to the magnetic pole direction of the rotor 100 and a q-axisthat is a torque axis is set to the direction orthogonal to the d-axiswithin a rotary plane of the rotor 100. The dq coordinate system is arotating coordinate system that rotates together with the rotor 100. Inthe dq coordinate system, because only a q-axis current contributes togeneration of torque of the rotor 100, a d-axis current is set to zeroand the q-axis current is controlled on the basis of a desired torque. Arotation angle (electrical angle) θ-S of the rotor 100 is a rotationangle of the d-axis with respect to the U-axis. The dq coordinate systemis an actual rotating coordinate system that rotates in accordance withthe rotor angle θ-S. With the use of the rotor angle θ-S, coordinateconversion between the UVW coordinate system and the dq coordinatesystem can be executed.

The microcomputer 40 includes a CPU and memories (a ROM, a RAM, anon-volatile memory, etc.), and is configured to function as a pluralityof functional processing units by executing predetermined programs. Thefunctional processing units include a current command value setting unit41, a current deviation computation unit 42, a PI (ProportionalIntegral) control unit 43, a dq/UVW conversion unit 44, a PWM (PulseWidth Modulation) control unit 45, a UVW/dq conversion unit 46, and arotation angle computation unit 47.

The rotation angle computation unit 47 computes a rotor rotation angle(electrical angle) (hereinafter, referred to as “rotor angle θ_(S)”) ofthe electric motor 18 on the basis of a signal output from the rotationangle sensor 25. The current command value setting unit 41 sets currentvalues, which are values of currents that should be passed throughcoordinate axes of the dq coordinate system, as current command values.Specifically, the current command value setting unit 41 sets a d-axiscurrent command value I_(d)* and a q-axis current command, value I_(q)*(hereinafter, the d-axis current command value I_(d)* and the q-axiscurrent, command value I_(q)* will be collectively referred to as“two-phase current command values I_(dq)*” where appropriate). Morespecifically, the current command value setting unit 41 sets the q-axiscurrent command value to a significant value, whereas it sets the d-axiscurrent command value I_(d)* to zero. The current command value settingunit 41 sets the q-axis current command value I_(d)* on the basis of thedetected steering torque Th detected by the torque sensor 11.

An example of a manner of setting the q-axis current command valueI_(q)* with respect to the detected steering torque Th is shown in FIG.4. With regard to the detected steering torque Th, for example, a torquefor steering to the right takes a positive value, and a torque forsteering to the left takes a negative value. The q-axis current commandvalue I_(q)* takes a positive value when an operation assist force forsteering to the right should be generated by the electric motor 18, andtakes a negative value when an operation assist force for steering tothe left should be generated by the electric motor 18. The q-axiscurrent command value I_(q)* with respect to a positive value of thedetected steering torque Th takes a positive value, and the q-axiscurrent command value I_(q)* with respect to a negative value of thedetected steering torque Th takes a negative value. When the detectedsteering torque Th is zero, the q-axis current command value I_(q)* iszero. The q-axis current command value I_(q)* is set such that theabsolute value of the q-axis current command value I_(q)* increases asthe absolute value of the detected steering torque Th increases.

The two-phase current command values I_(dq)* set by the current commandvalue setting unit 41 are provided to the current deviation computationunit 42. The current detection unit 32 detects a U-phase current I_(U),a V-phase current I_(V), and a W-phase current I_(W) for the electricmotor 18 (hereinafter, the U-phase current I_(U), the V-phase currentI_(V), and the W-phase current I_(W) will be collectively referred to as“three-phase detected currents I_(UVW)” where appropriate). Thethree-phase detected currents I_(UVW) detected by the current detectionunit 32 are provided to the UVW/dq conversion unit 46.

The UVW/dq conversion unit 46 executes coordinate conversion from thethree-phase detected currents I_(UVW) (the U-phase current I_(U), theV-phase current I_(V), and the W-phase current I_(W)) of the UVWcoordinate system, detected by the current detection unit 32, intotwo-phase detected currents I_(d), I_(q) of the dq coordinate system(hereinafter, the two-phase detected currents I_(d), I_(q) will becollectively referred to as “two-phase detected currents I_(dq)” whereappropriate). The rotor angle θ_(S) computed by the rotation anglecomputation, unit 47 is used for this coordinate conversion.

The current deviation computation unit 42 computes deviations betweenthe two-phase current command values I_(dq)* set by the current commandvalue setting unit 41 and the two-phase detected currents I_(dq)provided from the UVW/dq conversion unit 46. Specifically, the currentdeviation computation unit 42 computes a deviation of the d-axisdetected current I_(d) with respect to the d-axis current command valueI_(d)* and a deviation of the q-axis detected current I_(q) with respectto the q-axis current command value I_(q)*. These deviations areprovided to the PI control unit 43.

The PI control unit 43 generates two-phase voltage command valuesV_(dq)* (the d-axis voltage command value V_(d)* and the q-axis voltagecommand value V_(q)*), which are values of voltages that should beapplied to the electric motor 18, by executing a PI computation on thecurrent deviations computed by the current deviation computation unit42. The two-phase voltage command values V_(dq)* are provided to thedq/UVW conversion unit 44. The dq/UVW conversion, unit 44 executescoordinate conversion from the two-phase voltage command values V_(dq)*into three-phase voltage command values V_(UVW)*. The rotor angle θ_(S)computed by the rotation angle computation unit 47 is used for thiscoordinate conversion. The three-phase voltage command values V_(UVW)*consist of a U-phase voltage command value V_(U)*, a V-phase voltagecommand value V_(V)*, and a W-phase voltage command value V_(W)*. Thethree-phase voltage command values V_(UVW)* are provided to the PWMcontrol unit 45.

The PWM control unit 45 generates a U-phase PWM control signal, aV-phase PWM control signal, and a W-phase PWM control signal having dutyratios corresponding to the U-phase voltage command value V_(U)*, theV-phase voltage command value V_(V)*, and the W-phase voltage commandvalue V_(W)*, respectively, and provides these control signals to thedrive circuit 31. The drive circuit 31 is formed of an inverter circuitwith three phases corresponding to the U-phase, the V-phase, and theW-phase. When power elements constituting the inverter circuit arecontrolled by the PWM control signals provided from the PWM control unit45, voltages corresponding to the three-phase voltage command valuesV_(UVW)* are applied to the U-phase stator coil 101, the V-phase statorcoil 102 and the W-phase stator coil 103 of the electric motor 18.

The current deviation computation unit 42 and the PI control unit 43constitute a current feedback controller. Due to the action of thecurrent feedback controller, motor currents passing through the electricmotor 18 are controlled so as to approach the two-phase current commandvalues I_(dq)* set by the current command value setting unit 41. FIG. 5is a schematic view schematically showing the configuration of thetorque sensor 11.

An annular first magnet (a multipolar magnet) 61 is connected to theinput shaft 8 so as to be rotatable together with the input shaft 8. Twomagnetic sensors 71, 72 that respectively output sinusoidal signalshaving a phase difference in accordance with the rotation of the firstmagnet 61 are arranged below the first magnet 61. An annular secondmagnet (a multipolar magnet) 62 is connected to the output shaft 9 so asto be rotatable together with the output shaft 9. Two magnetic sensors74, 75 that respectively output sinusoidal signals having a phasedifference in accordance with the rotation of the second magnet 62 arearranged above the second magnet 62.

The output signals S₁, S₂, S₄, S₅ from the respective magnetic sensors71, 72, 74, 75 are input into a torque computation ECU 77 used tocompute a steering torque that is applied to the input shaft 8. A powersupply for the torque computation ECU 77 is turned on when an ignitionkey is turned on. When the ignition key is turned off, an ignition keyoff operation signal indicating that the ignition key is turned off isinput into the torque computation ECU 77. A magnetic sensor including anelement having electrical characteristics that vary due to the action ofa magnetic force, for example, a Hall element or a magnetoresistiveelement (a MR element) may be used as each of the magnetic sensors. Inthe present embodiment, a Hall element is used as each of the magneticsensors.

The magnets 61, 62, the magnetic sensors 71, 72, 74, 75, and the torquecomputation ECU 77 constitute the torque sensor 11. The torquecomputation ECU 77 includes a microcomputer. The microcomputer isprovided with a CPU and memories (a ROM, a RAM, a nonvolatile memory,etc.), and functions as a plurality of functional processing units byexecuting predetermined programs. The functional processing unitsinclude a first rotation angle computation unit 77A, a second rotationangle computation unit 77B, a torque computation unit 77C, a first phasedifference computation unit 77D, and a second phase differencecomputation unit 77E.

When the operation mode of the torque computation ECU 77 is set to aphase difference detection mode by an operator or the like, the firstphase difference computation unit 77D detects a phase difference betweenthe output signals S₁, S₂ from the two magnetic sensors 71, 72 on thebasis of the output signals S₁, S₂, and stores the detected phasedifference in a nonvolatile memory. When the operation mode of thetorque computation ECU 77 is set to the phase difference detection modeby the operator or the like, the second phase difference computationunit 77E detects a phase difference between the output signals S₄, S₅from the two magnetic sensors 74, 75 on the basis of the output signalsS₄, S₅, and stores the detected phase difference in the nonvolatilememory. For example, when the torque computation ECU 77 is replaced witha new one, the operation mode of the torque computation ECU 77 is set tothe phase difference detection mode. When the phase difference isdetected by the first phase difference computation unit 77D and thesecond phase difference computation unit 77E, the operation mode of thetorque computation ECU 77 is returned to the normal mode. Details of theoperations of the first phase difference computation unit 77D and thesecond phase difference computation unit 77E will be described later.

In the normal mode, the first rotation angle computation unit 77Acomputes a rotation angle (electrical angle θ_(A)) of the input shaft 8on the basis of the output signals S₁, S₂ from the two magnetic sensors71, 72 and the phase difference between the output signals S₁, S₂ storedin the nonvolatile memory. In the normal mode, the second rotation anglecomputation unit 77B computes a rotation angle (electrical angle θ_(B))of the output shaft 9 on the basis of the output signals S₄, S₅ from thetwo magnetic sensors 74, 75 and the phase difference between the outputsignals S₄, S₅ stored in the nonvolatile memory.

In the normal mode, the torque computation unit 77C computes thesteering torque Th applied to the input shaft 8 on the basis of therotation angle θ_(A) of the input shaft 8 detected by the first rotationangle computation unit 77A and the rotation angle θ_(B) of the outputshaft 9 detected by the second rotation angle computation unit 77B.Specifically, the steering torque Th is computed according to thefollowing expression (1) where K is a spring constant of the torsion bar10 and N is the number of magnetic pole pairs formed in each of themagnets 61, 62.Th={(θ_(A)−θ_(B))/N}×K  (1)

The first magnet 61, the magnetic sensors 71, 72, and the first rotationangle computation unit 77A constitute a first rotation angle detectiondevice used to detect the rotation angle θ_(A) of the input shaft 8. Thesecond magnet 62, the magnetic sensors 74, 75, and the second rotationangle computation unit 77B constitute a second rotation angle detectiondevice used to detect the rotation angle θ_(B) of the output shaft 9.Because an operation of the first rotation angle detection device (thefirst rotation angle computation unit 77A) is the same as an operationof the second rotation angle detection device (the second rotation anglecomputation unit 77B), only the operation of the first rotation angledetection device (the first rotation computation unit 77A) will bedescribed below.

FIG. 6 is a schematic diagram illustrating the configuration of thefirst magnet 61 and the arrangement of the two magnetic sensors 71, 72.The first magnet 61 has four magnetic pole pairs (M1, M2), (M3, M4),(M5, M6), (M7, M8) arranged at equal angular intervals in thecircumferential direction. That is, the first magnet 61 has the eightmagnetic poles M1 to M8 arranged at the equal angular intervals. Themagnetic poles M1 to M8 are arranged at angular intervals (angularwidths) of approximately 45° (approximately 180° in electrical angle)around the central axis of the input shaft 8. The magnitudes of magneticforces of the magnetic poles M1 to M8 are substantially equal to eachother.

The two magnetic sensors 71, 72 are arranged so as to face a lowerannular end face of the first magnet 61. The magnetic sensors 71, 72 arearranged at an angular interval of 120° in electrical angle around thecentral axis of the input shaft 8. In the following description, themagnetic sensor 71 will be referred to as a first magnetic sensor 71 andthe magnetic sensor 72 will be referred to as a second magnetic sensor72 where appropriate. The direction indicated by an arrow in FIG. 6 isdefined as the forward rotation direction of the input shaft 8. Therotation angle of the input shaft 8 increases as the input shaft 8 isrotated in the forward direction, and the rotation angle of the inputshaft 8 decreases as the input shaft 8 is rotated in the reversedirection. Sinusoidal signals S₁, S₂ are respectively output from themagnetic sensors 71, 72 in accordance with rotation of the input shaft8, as illustrated in FIG. 7. Note that a rotation angle (deg) on theabscissa axis in FIG. 7 represents a mechanical angle.

In the following description, the output signal S₁ from the firstmagnetic sensor 71 will be referred to as a first output signal S₁ or afirst sensor value S₁, and the output signal S₂ from the second magneticsensor 72 will be referred to as a second output signal S₂ or a secondsensor value S₂ where appropriate. In the following description, arotation angle of the input shaft 8 will be denoted by θ instead ofθ_(A), for convenience of explanation. If each of the output signals S₁,S₂ is a sinusoidal signal and a rotation angle of the input shaft 8 is θ(electrical angle), the output signal S₁ from the first magnetic sensor71 is expressed by S₁=A₁·sin θ, and the output signal S₂ from the secondmagnetic sensor 72 is represented as S₂=A₂·sin(θ+C). Each of A₁, A₂represents an amplitude. C represents a phase difference between thefirst output signal S₁ and the second output signal S₂.

A basic concept of a method of computing the rotation angle θ with theuse of the first rotation angle computation unit 77A will be described.There are two methods of computing the rotation angle θ. The firstmethod is a method of computing the rotation angle θ on the basis ofoutput signals from the two magnetic sensors 71, 72, the output signalsbeing sampled at two sampling timings (hereinafter, the first methodwill be referred to as “first computing method”). The second method is amethod of computing the rotation angle θ on the basis of output signalsfrom the two magnetic sensors 71, 72, the output signals being sampledat three sampling timings (hereinafter, the second method will bereferred to as “second computing method”).

A basic concept of the first computing method will be described. A phasedifference (electrical angle) between the first output signal S₁ and thesecond output signal will be denoted by C. The number of a presentsampling period (the number of a present computation period) will bedenoted by (n) and the number of an immediately preceding samplingperiod (the number of an immediately preceding computation period) willbe denoted by (n−1). With the use of the phase difference C and thenumbers (n), (n−1) of the sampling periods, the first-output signal S₁sampled in the present sampling period, the first output signal S₁sampled in the immediately preceding sampling period, the second outputsignal S₂ sampled in the present sampling period, and the second outputsignal S₂ sampled in the immediately preceding sampling period areexpressed, by the following expressions (2a), (2b), (2c), (2d),respectively.S ₁(n)=A ₁(n)sin θ(n)  (2a)S ₁(n−1)=A ₁(n−1)sin θ(n−1)  (2b)S ₂(n)=A ₂(n)sin(θ(n)+C)  (2c)S ₂(n−1)=A ₂(n−1)sin(θ(n−1)+C)  (2d)

If C is a known quantity, the number of unknown quantifies (A₁(n),A₁(n−1), A₂(n), A₂(n−1), θ(n), θ(n−1)) included in the four expressionsis six. That, is, because the number of the unknown quantities isgreater than the number of the expressions, simultaneous equationsconstituted of the four expressions cannot be solved in this state.

Therefore, by setting a short sampling interval (sampling period),variations of amplitudes due to temperature changes between two samplingtimings are assumed to be non-existent. That is, on the assumption thatamplitudes A₁(n), A₁(n−1) of the output signals from the first magneticsensor 71 at two sampling timings are equal to each other, theamplitudes A₁(n), A₁(n−1) are expressed by A₁. Similarly, on theassumption that amplitudes A₂(n), A₂(n−1) of the output signals from thesecond magnetic sensor 72 at two sampling timings are equal to eachother, the amplitudes A₂(n), A₂(n−1) are expressed by A₂. Thus, theexpressions (2a), (2b), (2e), (2d) can be expressed by the followingexpressions (3a), (3b), (3c), (3d), respectively.S ₁(n)=A ₁ sin θ(n)  (3a)S ₁(n−1)=A ₁ sin θ(n−1)  (3b)S ₂(n)=A ₂ sin(θ(n)+C)  (3c)S ₂(n−1)=A ₂ sin(θ(n−1)+C)  (3d)

The number of unknown quantities (A₁, A₂, θ(n), θ(n−1)) included in thefour expressions is four. That is, because the number of the unknownquantities is equal to or smaller than the number of expressions,simultaneous equations constituted of the four expressions can besolved. Therefore, by solving the simultaneous equations constituted ofthe four expressions (3a), (3b), (3c), (3d), the rotation angle θ(n) ofthe input shaft 8 can be computed.

Hereinafter, the case where the phase difference C between thesinusoidal signals respectively output from the magnetic sensors 71, 72is 120° will be described in detail. When the phase difference C is120°, the four expressions (3a), (3b), (3c), (3d) can be expressed bythe following expressions (4a), (4b), (4c), (4d), respectively.S ₁(n)=A ₁ sin θ(n)  (4a)S ₁(n−1)=A ₁ sin θ(n−1)  (4b)S ₂(n)=A ₂ sin(θ(n)+120)  (4c)S ₂(n−1)=A ₂ sin(θ(n−1)+120)  (4d)

By solving simultaneous equations constituted of the four expressions(4a), (4b), (4c), (4d), the rotation angle θ(n) of the input shaft 8 canbe expressed by the following expression (5) (hereinafter, referred toas “basic arithmetic expression (5)”).

$\begin{matrix}{{{\theta\lbrack n\rbrack} = {{\frac{1}{4}{\cos^{- 1}\left( {1 - \frac{\left( {{3\; p_{1}^{2}p_{2}^{2}} - {2\; p_{1}^{2}} - {2\; p_{2}^{2}} + {p_{1}p_{2}}} \right)^{2}}{2\left( {p_{1} - p_{2}} \right)^{2}\left( {p_{1}^{2} + {p_{1}p_{2}} + p_{2}^{2}} \right)}} \right)}} - {\frac{1}{4}{\cos^{- 1}\left( {\frac{1}{2} - {\frac{3}{2} \cdot \frac{{p_{1}p_{2}} + p_{2}^{2}}{p_{1}^{2} + {p_{1}p_{2}} + p_{2}^{2}}}} \right)}}}}\mspace{79mu}{where}\mspace{79mu}{p_{1} = \frac{S_{1}\lbrack n\rbrack}{S_{1}\left\lbrack {n - 1} \right\rbrack}}\mspace{79mu}{p_{2} = \frac{S_{2}\lbrack n\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}}} & (5)\end{matrix}$

Therefore, when the phase difference C between the sinusoidal signalsrespectively output from the magnetic sensors is 120°, the rotationangle θ(n) of the Input shaft 8 can be computed, with the use of foursensor values S₁(n), S₁(n−1), S₂(n), S₂(n−1) and the basic arithmeticexpression (5). However, when at least one of the denominators of thefractions included in the basic arithmetic expression (5) is zero, therotation angle θ(n) cannot be computed according to the basic arithmeticexpression (5). Therefore, in the present embodiment, when at least oneof the denominators of the fractions included in the basic arithmeticexpression (5) is zero, the rotation angle θ(n) is computed according toan arithmetic expression different from the basic arithmetic expression(5). Further, in the present embodiment, if the rotation angle θ(n) canbe computed according to an arithmetic expression that is simpler thanthe basic arithmetic expression (5) although the rotation angle θ(n) canbe computed according to the basic arithmetic expression (5), therotation angle θ(n) is computed according to the arithmetic expressionthat is simpler than the basic arithmetic expression (5). In the presentembodiment, the case where the rotation angle θ(n) can be computed moreeasily than using the basic arithmetic expression (5) is the case whereS₂(n)=0 or the case where S₁(n)=0.

In the present embodiment, as arithmetic expressions used to compute therotation angle θ(n), ten kinds of arithmetic expressions including thebasic arithmetic expression (5) are prepared. Table 1 shows the tenkinds of arithmetic expressions and the conditions for the arithmeticexpressions. Note that, at the time of computing the rotation angleθ(n), whether the conditions are satisfied is determined starting fromthe conditions on the top of Table 1. If it is determined that theconditions are satisfied, whether the subsequent conditions aresatisfied is not determined. Then, the rotation angle θ(n) is computedaccording to the arithmetic expression corresponding to the conditionsthat are determined to be satisfied.

TABLE 1 CONDITIONS (AND) ARITHMETIC EXPRESSIONS 1 S₁[n] ≠ 0, S₂[n − 1] ≠0, S₂[n] ≠ 0, S₁[n − 1] ≠ 0, P₁-P₂ ≠ 0 BASIC ARITHMETIC EXPRESSION(EXPRESSION (5)) 2 S₁[n] ≠ 0, S₂[n − 1] ≠ 0, S₂[n] ≠ 0, S₁[n − 1] ≠ 0,P₁-P₂ = 0 θ[n] ← IMMEDIATELY PRECEDING VALUE 3 S₁[n] ≠ 0, S₂[n − 1] ≠ 0,S₂[n] ≠ 0, S₁[n − 1] = 0, S₂[n − 1] > 0${\theta\lbrack n\rbrack} = {{\sin^{- 1}\left( {\frac{\sqrt{3}}{2} \cdot \frac{S_{2}\lbrack n\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}} \right)} - 120}$4 S₁[n] ≠ 0, S₂[n − 1] ≠ 0, S₂[n] ≠ 0, S₁[n − 1] = 0, S₂[n − 1] < 0${\theta\lbrack n\rbrack} = {{\sin^{- 1}\left( {{- \frac{\sqrt{3}}{2}} \cdot \frac{S_{2}\lbrack n\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}} \right)} - 120}$5 S₁[n] ≠ 0, S₂[n − 1] ≠ 0, S₂[n] = 0, S₁[n] > 0 θ[n] = 60 6 S₁[n] ≠ 0,S₂[n − 1] ≠ 0, S₂[n] = 0, S₁[n] < 0 θ[n] = −120 7 S₁[n] ≠ 0, S₂[n − 1] =0, S₁[n − 1] > 0${\theta\lbrack n\rbrack} = {\sin^{- 1}\left( {\frac{\sqrt{3}}{2} \cdot \frac{S_{1}\lbrack n\rbrack}{S_{1}\left\lbrack {n - 1} \right\rbrack}} \right)}$8 S₁[n] ≠ 0, S₂[n − 1] = 0, S₁[n − 1] < 0${\theta\lbrack n\rbrack} = {\sin^{- 1}\left( {{- \frac{\sqrt{3}}{2}} \cdot \frac{S_{1}\lbrack n\rbrack}{S_{1}\left\lbrack {n - 1} \right\rbrack}} \right)}$9 S₁[n] = 0, S₂[n] > 0 θ[n] = 0 10 S₁[n] = 0, S₂[n] < 0 θ[n] = 180

The first arithmetic expression from the top of Table 1 is the basicarithmetic expression (5). The basic arithmetic expression (5) is usedwhen the condition that neither S₁(n) nor S₂(n) is zero and thecondition that none of the denominators of the fractions included in thebasic arithmetic expression (5) are zero are both satisfied. Thecondition that none of the denominators of the fractions included in thebasic arithmetic expression (5) are zero is satisfied when p₁−p₂≠0, p₁²+p₁p₂+p₂ ²≠0, S₁(n−1)≠0, and S₂(n−1)≠0. Note that S₁(n−1) is thedenominator of p₁ and S₂(n−1) is the denominator of p₂.

Note that, p₁ ²+p₁p₂+p₂ ²=0 is satisfied only when p₁=p₂=0. However, thephase of a sinusoidal signal output from the first magnetic sensor 71 is120° different from the phase of a sinusoidal signal output from thesecond magnetic sensor 72, and hence the sensor values S₁, S₂ from boththe magnetic sensors 71, 72 do not become zero at the same time.Therefore, p₁ ²+p₁p₂+p₂ ²=0 is not satisfied. Therefore, the conditionthat none of the denominators of the fractions included in the basicarithmetic expression (5) are zero is satisfied when ail the conditionsthat p₁−p₂≠0, S₁(n−1)≠0, and S₂(n−1)≠0 are satisfied.

The second arithmetic expression from the top of Table 1 is anarithmetic expression that is used when p₁−p₂=0. The case where p₁−p₂=0is satisfied will be considered blow. In this case, because p₁=p₂, thefollowing expression (6) is satisfied.

$\begin{matrix}{\frac{A_{1}\sin\;{\theta\lbrack n\rbrack}}{A_{1}\sin\;{\theta\left\lbrack {n - 1} \right\rbrack}} = \frac{A_{2}{\sin\left( {{\theta\lbrack n\rbrack} + 120} \right)}}{A_{2}{\sin\left( {{\theta\left\lbrack {n - 1} \right\rbrack} + 120} \right)}}} & (6)\end{matrix}$

When this expression is deformed, the following expression (7) can beobtained.

$\begin{matrix}{{\frac{\sin\;{\theta\left\lbrack {n - 1} \right\rbrack}}{\sin\;{\theta\lbrack n\rbrack}} \cdot \frac{\sin\left( {{\theta\lbrack n\rbrack} + 120} \right)}{\sin\left( {{\theta\left\lbrack {n - 1} \right\rbrack} + 120} \right)}} = 1} & (7)\end{matrix}$

The case where the expression (7) is satisfied is the case where θ(n) isequal to θ(n−1), that is, the case where the present rotation angle θ(n)is equal to the immediately preceding rotation angle η(n−1). When thecondition that neither S₁(n) nor S₂(n) is zero, the condition thatneither the denominator S₁(n−1) of p₁ nor the denominator S₂(n−1) of p₂is zero, and the condition that p₁−p₂=0 are all satisfied, theimmediately preceding computed rotation angle θ(n−1) is used as thepresent rotation angle θ(n).

The third and fourth arithmetic expressions from the top of Table 1 arearithmetic expressions that are used when the denominator S₁(n−1) of p₁is zero. Because S₁(n−1)=A₁ sin θ(n−1), S₁(n−1)=0 is satisfied when sinθ(n−1)=0. That is, when θ(n−1) is 0° or 180°, S₁(n−1) is zero. BecauseS₂(n−1)=A₂ sin(θ(n−1)+120), S₂(n−1)>0 is satisfied when θ(n−1) is 0°,and S₂(n−1)<0 is satisfied when θ(n−1) is 180°. Therefore, θ(n−1)=0 issatisfied when S₁(n−1)=0 and S₂(n−1)>0, and θ(n−1)=180 is satisfied whenS₁(n−1)=0 and S₂(n−1)<0.

When θ(n−1)=0, the expressions (4c), (4d) are expressed by the followingexpressions (8c), (8d), respectively.S ₂(n)=A ₂ sin(θ(n)+120)  (8c)S ₂(n−1)=A ₂ sin 120=√3/2·A ₂  (8d)

The following expression (9) can be obtained from the expression (8d)A ₂=(2/√3)·S ₂(n−1)  (9)

When the expression (9) is substituted into the expression (8c), thefollowing expression (10) can be obtained.sin(θ(n)+120)=(√3/2)·(S ₂(n)/S ₂(n−1))  (10)

Therefore, the rotation angle θ(n) can be computed according to thefollowing expression (11).

$\begin{matrix}{{\theta\lbrack n\rbrack} = {{\sin^{- 1}\left( {\frac{\sqrt{3}}{2} \cdot \frac{S_{2}\lbrack n\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}} \right)} - 120}} & (11)\end{matrix}$

As shown in the third row from the top of Table 1, when the conditionsthat neither S₁(n) nor S₂(n) is zero, the denominator S₂(n−1) of p₂ isnot zero, the denominator S₁(n−1) of p₁ is zero, and S₂(n−1)>0 are allsatisfied, the rotation angle θ(n) is computed according to thearithmetic expression expressed by the expression (11). On the otherhand, when θ(n−1)=180, the expressions (4c), (4d) are expressed by thefollowing expressions (12c), (12d), respectively.S ₂(n)=A ₂ sin(θ(n)+120)  (12c)S ₂(n−1)=A ₂ sin 300=−√3/2·A ₂  (12d)

The following expression (13) can be obtained from the expression (12d).A ₂=(−2/√3)·S ₂(n−1)  (13)

When the expression (13) is substituted into the expression (12c), thefollowing expression (14) can be obtained.sin(θ(n)+120)=(−√3/2)·(S ₂(n)/S ₂(n−1))  (14)

The rotation angle θ(n) can be computed according to the followingexpression (15).

$\begin{matrix}{{\theta\lbrack n\rbrack} = {{\sin^{- 1}\left( {{- \frac{\sqrt{3}}{2}} \cdot \frac{S_{2}\lbrack n\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}} \right)} - 120}} & (15)\end{matrix}$

As shown in the fourth row from the top of Table 1, when the conditionsthat neither S₁(n) nor S₂(n) is zero, the denominator S₂(n−1) of p₂ isnot zero, the denominator S₁(n−1) of p₁ is zero, and S₂(n−1)<0 are allsatisfied, the rotation angle θ(n) is computed according to thearithmetic expression expressed by the expression (15). The fifth andsixth arithmetic expressions from the top of Table 1 are arithmeticexpressions used when S₂(n)=0 is satisfied. Because S₂(n)=A₂sin(θ(n)+120), when sin(θ(n)+120)=0, S₂(n)=0 is satisfied. That is, whenθ(n) is −120° or 60°, S₂(n)=0 is satisfied. Because S₁(n)=A₁ sin θ(n),S₁(n)<0 is satisfied when θ(n) is −120°, and S₁(n)>0 is satisfied whenθ(n)=60°. θ(n)=60 is satisfied when θ(n)=0 and S₁(n)>0, and θ(n)=−120 issatisfied when S₂(n)=0 and S₁(n)<0.

As shown in the fifth row from the top of Table 1, when the conditionsthat S₁(n) is not zero, the denominator S₂(n−1) of p₂ is not zero,S₂(n)=0, and S₁(n)>0 are all satisfied, the rotation angle θ(n) iscomputed as 60°. Further, as shown in the sixth row from the top ofTable 1, when the conditions that S₁(n) is not zero, the denominatorS₂(n−1) of p₂ is not zero, S₂(n)=0, and S₁(n)<0 are all satisfied, therotation angle θ(n) is computed as −120°.

The seventh and eighth arithmetic expressions from the top of Table 1are arithmetic expressions used when the denominator S₂(n−1) of p₂ iszero. Because S₂(n−1)=A₂ sin(θ(n−1)+120), when sin(θ(n−1)+120)=0,S₂(n−1)=0 is satisfied. That is, when θ(n−1) is −120° or 60°, S₂(n−1) iszero. Because S₁(n−1)=A₁ sin θ(n−1), S₁(n−1)<0 is satisfied when θ(n−1)is −120°, and S₁(n−1)>0 is satisfied when θ(n−1) is 60°. Therefore,θ(n−1)=60 is satisfied, when S₂(n−1)=0 and S₁(n−1)>0, and θ(n−1)=−120 issatisfied when S₂(n−1)=0 and S₁(n−1)<0.

When θ(n−1)=60, the expressions (4a), (4b) are expressed by thefollowing expressions (16a), (16b), respectively.S ₁(n)=A ₁ sin θ(n)  (16a)S ₁(n−1)=A ₁ sin 60=√3/2·A ₁  (16b)

On the basis of the expression (16b), the following expression (17) canbe obtained.A ₁=(2/√3)·S ₁(n−1)  (17)

When the expression (17) is substituted into the expression (16a), thefollowing expression (18) can be obtained.sin θ(n)=(√3/2)·(S ₁(n)/S ₁(n−1))  (18)

Therefore, the rotation angle θ(n) can be computed by the followingexpression (19).

$\begin{matrix}{{\theta\lbrack n\rbrack} = {\sin^{- 1}\left( {\frac{\sqrt{3}}{2} \cdot \frac{S_{1}\lbrack n\rbrack}{S_{1}\left\lbrack {n - 1} \right\rbrack}} \right)}} & (19)\end{matrix}$

As shown in the seventh row from the top of Table 1, when the conditionsthat S₁(n) is not zero, the denominator S₂(n−1) of p₂ is zero, andS₁(n−1)>0 are all satisfied, the rotation angle θ(n) is computedaccording to the arithmetic expression expressed by the expression (19).On the other hand, when θ(n−1)=−120, the expressions (4a), (4b) areexpressed by the following expressions (20a), (20b), respectively.S ₁(n)=A ₁ sin θ(n)  (20a)S ₁(n−1)=A ₁ sin(−120)=−√3/2·A ₂  (20b)

The following expression (21) can be obtained from the expression (20b).A ₁=(−2/√3)·S ₁(n−1)  (21)

When the expression (21) is substituted into the expression (20a), thefollowing expression (22) can be obtained.sin θ(n)=(−√3/2)·(S ₁(n)/S ₁(n−1))  (22)

Therefore, the rotation angle θ(n) can be computed according to thefollowing expression (23).

$\begin{matrix}{{\theta\lbrack n\rbrack} = {\sin^{- 1}\left( {{- \frac{\sqrt{3}}{2}} \cdot \frac{S_{1}\lbrack n\rbrack}{S_{1}\left\lbrack {n - 1} \right\rbrack}} \right)}} & (23)\end{matrix}$

As expressed by the eighth row from the top of Table 1, when theconditions that S₁(n) is not zero, the denominator S₂(n−1) of p₂ iszero, and S₁(n−1)<0 are all satisfied, the rotation angle θ(n) iscomputed according to an arithmetic expression expressed by theexpression (23). The ninth and tenth arithmetic expressions from the topof Table 1 are arithmetic expressions that are used when S₁(n)=0 issatisfied. Because S₁(n)=A₁ sin θ(n), when sin θ(n)=0, S₁(n)=0 issatisfied. That is, when θ(n) is 0° or 180°, S₁(n)=0 is satisfied.Because S₂(n)=A₂ sin(θ(n)+120), S₂(n)>0 is satisfied when θ(n) is 0°,and S₂(n)<0 is satisfied when θ(n) is 180°. Therefore, θ(n)=0 issatisfied when S₁(n)=0 and S₂(n)>0, and θ(n)=180 is satisfied whenS₁(n)=0 and S₂(n)<0.

As shown in the ninth row from the top of Table 1, when the conditionsthat S₁(n) is zero and S₂(n)>0 are both satisfied, the rotation angleθ(n) is computed as 0°. Further, as shown in the tenth row from the topof Table 1, when the conditions that S₁(n) is zero and S₂(n)>0 are bothsatisfied, the rotation angle is computed as 180°. According to thefirst computing method, because the rotation angle θ(n) of the inputshaft 8 is computed on the basis of the output signals from the twomagnetic sensors 71, 72, which are sampled at two sampling timings, thehighly accurate rotation angle can be computed. Furthermore, accordingto the first computing method, even if the number of expressions used tocompute the rotation angle θ(n) of the input shaft 8 is smaller than thenumber of unknown quantities originally included in these expressions,the rotation angle θ(n) of the input shaft 8 can be computed. As aresult, the number of sensor values required to compute the rotationangle θ(n) of the input shaft 8 can be reduced.

According to the first computing method, by setting a short samplingperiod, the amplitudes (A₁(n) and A₁(n−1); A₂(n) and A₂(n−1)) of theoutput signals from the same magnetic sensor at the two sampling timingsare assumed to be equal to each other. The amplitudes of the outputsignals from the same magnetic sensor at two sampling timings may bedifferent values due to the influence of temperature changes. However,if the sampling interval is short, a temperature change between the twosampling timings is considerably small. Therefore, the amplitudes of theoutput signals from the same magnetic sensor at the two sampling timingsmay be assumed to be equal to each other. In the first computing method,variations of amplitudes due the influence of temperature changesbetween the two sampling timings can be compensated for. In the firstcomputing method, because the amplitudes A₁, A₂ of the output signalsfrom the magnetic sensors 71, 72 are regarded as different unknownquantities, the influence of variations of temperature characteristicsbetween the magnetic sensors 71, 72 can be compensated for. As a result,the highly accurate rotation angle can be detected.

A basic concept of the second computing method will be described below.A phase difference (electrical angle) between the first output signal S₁and the second output signal S₂ will be denoted by C. The number of thepresent sampling period (the number of the present computation period)will be denoted by (n), the number of the immediately preceding samplingperiod will be denoted by (n−1), and the number of the second precedingsampling period will be denoted by (n−2). A correction value used tocorrect a rotation angle computing error due to the variations ofangular widths (magnetic pole widths) of the magnetic poles M1 to M8will be referred, to as an angular width error correction value(magnetic pole width error correction value), and will be denoted by E.

When the phase difference C, the numbers of the sampling periods (n),(n−1), (n−2), and the angular width error correction value E are used,the first output signals S₁ sampled in the present sampling period, theimmediately preceding sampling period, and the second preceding samplingperiod, and the second, output signals S₂ sampled in the presentsampling period, the immediately preceding sampling period, and thesecond preceding sampling period can be expressed by the followingexpressions (24a), (24b), (24c), (24d), (24e), (24f), respectively.S ₁(n)=A ₁(n)sin(E ₁(n)θ(n))  (24a)S ₁(n−1)=A ₁(n−1)sin(E ₁(n−1)θ(n−1))  (24b)S ₁(n−2)=A ₁(n−2)sin(E ₁(n−2)θ(n−2))  (24c)S ₂(n)=A ₂(n)sin(E ₂(n)θ(n)+C)  (24d)S ₂(n−1)=A ₂(n−1)sin(E ₂(n−1)θ(n−1)+C)  (24e)S ₂(n−2)=A ₂(n−2)sin(E ₂(n−2)θ(n−2)+C)  (24f)

In the expressions (24a) to (24f), E₁(x) is an angular width errorcorrection value corresponding to a magnetic pole sensed by the firstmagnetic sensor 71 in an λ-th computation period. E₂(x) is an angularwidth error correction value corresponding to a magnetic pole sensed bythe second magnetic sensor 72 in an x-th computation period.

The number of magnetic poles of the magnet 61 will be denoted by m.Furthermore, a natural number from 1 to m, which is used to relativelyidentify each magnetic pole, will be denoted by i. When an angular widthof a given magnetic pole is denoted by w(i) (electrical angle) and anangular width error of the given magnetic pole is denoted by θ_(err)(i)(electrical angle), θ_(err)(i) is expressed by the following expression(25).θ_(err)(i)=w(i)=180  (25)

When the angular width error correction value for the given magneticpole is denoted by E(i), E(i) is defined by the following expression(26).

$\begin{matrix}\begin{matrix}{{E(i)} = {180/{w(i)}}} \\{= {180/\left( {{\theta_{err}(i)} + 180} \right)}}\end{matrix} & (26)\end{matrix}$

The angular width error correction value E(i) for each magnetic pole isinformation regarding a pitch width of the magnetic pole. Note that theinformation regarding the pitch width of each magnetic pole may be anangular width w(i) of the magnetic pole or an angular width errorθ_(err)(i) of the magnetic pole.

If C is a known quantity, the number of unknown quantities included inthe six expressions expressed by the expressions (24a) to (24f) is 16.That is, because the number of the unknown quantities is greater thanthe number of the expressions, simultaneous equations constituted of thesix expressions cannot be solved in this state. Therefore, by setting ashort sampling interval (sampling period), variations of amplitudes dueto temperature changes between three sampling timings are assumed to benon-existent. That is, on the assumption that amplitudes A₁(n), A₁(n−1)A₁(n−2) of the output signals from the first magnetic sensor 71, whichare sampled at three sampling timings, are equal to each other, theamplitudes A₁(n), A₁(n−1), A₁(n−2) are expressed by A₁. Similarly, onthe assumption that amplitudes A₂(n), A₂(n−1), A₂(n−2) of the outputsignals from the second magnetic sensor 72, which are sampled at threesampling timings, are equal to each other, the amplitudes A₂(n),A₂(n−1), A₂(n−2) are expressed by A₂.

Further, both the magnetic sensors 71, 72 are assumed to sense one andthe same magnetic pole at three sampling timings. That is, all theangular width error correction values E₁(n), E₁(n−1), E₁(n−2), E₂(n),E₂(n−1), E₂(n−2) included in the output signals from the magneticsensors 71, 72, which are sampled at the three sampling timings, areassumed to be angular width error correction values for one and the samemagnetic pole, and they will be denoted by E(i). Thus, the expressions(24a) to (24f) can be expressed by the following expressions (27a) to(27f), respectively.S ₁(n)=A ₁ sin(E(i)·θ(n))  (27a)S ₁(n−1)=A ₁ sin(E(i)·θ(n−1))  (27b)S ₁(n−2)=A ₁ sin(E(i)·θ(n−2))  (27c)S ₂(n)=A ₂ sin(E(i)·θ(n)+C)  (27d)S ₂(n−1)=A ₂ sin(E(i)·θ(n−1)+C)  (27e)S ₂(n−2)=A ₂ sin(E(i)·θ(n−2)+C)  (27f)

The number of unknown quantities (A₁, A₂, E(i), θ(n), θ(n−1), θ(n−2))included in the six expressions is six. That is, the number of theunknown quantities is equal to or smaller than the number of theexpressions, and hence simultaneous equations constituted of the sixexpressions can be solved. Therefore, by solving the simultaneousequations constituted of the six expressions (27a) to (27f), therotation angle θ(n) of the input shaft 8 can be computed.

Hereinafter, the case where the phase difference C between thesinusoidal signals output from the magnetic sensors 71, 72 is 120° willbe described in detail. When the phase difference C is 120°, the sixexpressions (27a) to (27f) can be expressed by the following expressions(28a) to (28f), respectively.S ₁(n)=A ₁ sin(E(n)·θ(n))  (28a)S ₂(n−1)=A ₁ sin(E(i)·θ(n−1))  (28b)S ₁(n−2)=A ₁ sin(E(i)·θ(n−2))  (28c)S ₂(n)=A ₂ sin(E(i)·θ(n)+120)  (28d)S ₂(n−1)=A ₂ sin(E(i)·θ(n−1)+120)  (28e)S ₂(n−2)=A ₂ sin(E(i)·θ(n−2)+120)  (28f)

According to the basic expression (5), E(i)·θ(n) is expressed by thefollowing expression (29).

$\begin{matrix}{{{{E(i)} \cdot {\theta\lbrack n\rbrack}} = {{\frac{1}{4}{\cos^{- 1}\left( {1 - \frac{\left( {{3p_{1}^{2}p_{2}^{2}} - {2p_{1}^{2}} - {2p_{2}^{2}} + {p_{1}p_{2}}} \right)^{2}}{2\left( {p_{1} - p_{2}} \right)^{2}\left( {p_{1}^{2} + {p_{1}p_{2}} + p_{2}^{2}} \right)}} \right)}} - {\frac{1}{4}{\cos^{- 1}\left( {\frac{1}{2} - {\frac{3}{2} \cdot \frac{{p_{1}p_{2}} + p_{2}^{2}}{p_{1}^{2} + {p_{1}p_{2}} + p_{2}^{2}}}} \right)}}}}\mspace{20mu}{where}\mspace{20mu}{p_{1} = \frac{S_{1}\lbrack n\rbrack}{S_{1}\left\lbrack {n - 1} \right\rbrack}}\mspace{20mu}{p_{2} = \frac{S_{2}\lbrack n\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}}} & (29)\end{matrix}$

Furthermore, by solving simultaneous equations constituted of the sixexpressions (28a) to (28f), the angular width error correction valueE(i) can be expressed by the following expression (30).

$\begin{matrix}{{E = {\frac{1}{240} \cdot {\cos^{- 1}\left( {\frac{{q_{1}^{2}t^{2}} - {2q_{1}q_{2}t} + q_{2}^{2}}{2{t\left( {{{S_{1}\lbrack n\rbrack}{S_{2}\lbrack n\rbrack}} - {{S_{1}\left\lbrack {n - 1} \right\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}}} \right)}^{2}} - 1} \right)}}}{where}{q_{1} = {{S_{1}\left\lbrack {n - 1} \right\rbrack}^{2} - {S_{1}\lbrack n\rbrack}^{2}}}{q_{2} = {{S_{2}\lbrack n\rbrack}^{2} - {S_{2}\left\lbrack {n - 1} \right\rbrack}^{2}}}{t = \frac{\begin{matrix}{{{S_{1}\lbrack n\rbrack}{S_{2}\lbrack n\rbrack}q_{3}} + {{S_{1}\left\lbrack {n - 1} \right\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}q_{4}} +} \\{{S_{1}\left\lbrack {n - 2} \right\rbrack}{S_{2}\left\lbrack {n - 2} \right\rbrack}q_{1}}\end{matrix}}{\begin{matrix}{{{S_{1}\lbrack n\rbrack}{S_{2}\lbrack n\rbrack}q_{5}} + {{S_{1}\left\lbrack {n - 1} \right\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}q_{6}} +} \\{{S_{1}\left\lbrack {n - 2} \right\rbrack}{S_{2}\left\lbrack {n - 2} \right\rbrack}q_{2}}\end{matrix}}}{q_{3} = {{S_{1}\left\lbrack {n - 2} \right\rbrack}^{2} - {S_{1}\left\lbrack {n - 1} \right\rbrack}^{2}}}{q_{4} = {{S_{1}\lbrack n\rbrack}^{2} - {S_{1}\left\lbrack {n - 2} \right\rbrack}^{2}}}{q_{5} = {{S_{2}\left\lbrack {n - 1} \right\rbrack}^{2} - {S_{2}\left\lbrack {n - 2} \right\rbrack}^{2}}}{q_{6} = {{S_{2}\left\lbrack {n - 2} \right\rbrack}^{2} - {S_{2}\lbrack n\rbrack}^{2}}}} & (30)\end{matrix}$

By dividing E(i)·θ(n) computed from the expression (29) by the angularwidth error correction value E(i) obtained from the expression (30),θ(n) can be obtained. That is, θ(n) can be obtained according to thefollowing expression (31).θ(n)=E(i)·θ(n)/E  (31)

Note that, E(i)·θ(n) is computed according to the arithmetic expressioncorresponding to the conditions according to Table 1. Further, when atleast one of the denominators of the fractions included in theexpression (30) is zero, the angular width error correction value E(i)cannot be computed according to the expression (30). Therefore, in thepresent, embodiment, when at least one of the denominators of thefractions included in the expression (30) is zero, the immediatelypreceding computed angular width error correction value E(i) is used asthe present angular width error correction value E(i).

Note that the case where at least one of the denominators of thefractions included in the expression (30) is zero is the case where atleast one of the three conditions expressed, by the followingexpressions (32), (33), (34) is satisfied.S ₁ [n]S ₂ [n]−S ₁ [n−1]S ₂ [n−1]=0  (32)S ₁ [n]S ₂ [n]q ₃ +S ₁ [n−1]S ₂ [n−1]q ₄ +S ₁ [n−2]S ₂ [n−2]q ₁=0  (33)S ₁ [n]S ₂ [n]q ₅ +S ₁ [n−1]S ₂ [n−1]q ₆ +S ₁ [n−2]S ₂ [n−2]q ₂=0  (34)q ₁ =S ₁ [n−1]² −S ₁ [n] ²q ₂ =S ₂ [n] ² −S ₂ [n−1]²q ₃ =S ₁ [n−2]² −S ₁ [n−1]²q ₄ =S ₁ [n] ² −S ₁ [n−2]²q ₅ =S ₂ [n−1]² −S ₂ [n−2]²q ₆ =S ₂ [n−2]² −S ₂ [n] ²

According to the second computing method, because the rotation angleθ(n) of the input shaft 8 is computed on the basis of the output signalsfrom the two magnetic sensors 71, 72, which are sampled at threesampling timings, the highly accurate rotation angle can be computed. Inthe second computing method, even if the number of expressions used tocompute the rotation angle θ(n) of the input shaft 8 is smaller than thenumber of unknown quantities originally included in these expressions,the rotation angle θ(n) of the input shaft 8 can be computed, and hencethe number of sensor values required to compute the rotation angle θ(n)of the input shaft 8 can be reduced.

According to the second computing method, the amplitudes (A₁(n), A₁(n−1)and A₁(n−2); A₂(n), A₂(n−1) and A₂(n−2)) of the output signals from thesame magnetic sensor, which are sampled at the three sampling timings,are assumed to be equal to each other. The amplitudes of the outputsignals from the same magnetic sensor, which are sampled at threesampling timings, may be different values due to the influence oftemperature changes. However, if the sampling interval is short, atemperature change between the three sampling timings is considerablysmall. Therefore, the amplitudes of the output signals from the samemagnetic sensor, which are sampled at the three sampling timings, may beassumed to be equal to each other. Therefore, in the second computingmethod, variations of amplitudes due the influence of temperaturechanges between the three sampling timings can be compensated for. Inthe second computing method, because the amplitudes A₁, A₂ of theoutput, signals from the magnetic sensors 71, 72 are regarded asdifferent unknown quantities, the influence of variations of temperaturecharacteristics between the magnetic sensors 71, 72 can be compensatedfor. As a result, the highly accurate rotation angle can be detected.

In the second computing method, all the angular width error correctionvalues E(i) included in the six expressions used to compute the rotationangle θ(n) are assumed to be equal to each other. The angular widtherror correction value E(i) varies from one magnetic pole to another.Therefore, the angular width error correction values E(i) included inthe expressions that express the six output signals S₁(n), S₁(n−1),S₁(n−2), S₂(n), S₂(n−1), S₂(n−2) used to compute the rotation angle θ(n)do not always take the same value. However, when the two magneticsensors 71, 72 sense one and the same magnetic pole at three samplingtimings, all the angular width error correction values E(i) included inthe expressions that express the output signals take the same value.Therefore, in the second computing method, when the two magnetic sensors71, 72 sense one and the same magnetic pole at three sampling timings,variations of angular widths (pitch widths) of the magnetic poles M1 toM8 of the magnet 61 can be compensated for. As a result, the highlyaccurate rotation angle can be detected.

FIG. 8 is a flowchart showing the operation of the first rotation anglecomputation unit 77A. When a power supply for the torque computation ECU77 is turned on, the first rotation angle computation unit 77A executesa rotation angle computing process based on forced rotation (step S1).In this process, the electric motor 18 is forced to rotate temporarilyto rotate the input shaft 8 (the output shaft 9), and the rotation angleθ of the input shaft 8 is computed. Details of the process will bedescribed later.

In the first computing method and the second computing method describedabove, if the output signals S₁, S₂ from the respective magnetic sensors71, 72 are not changed between the immediately preceding sampling timingand the present, sampling timing, p₁=p₂ is satisfied, and hence theimmediately preceding computed rotation angle θ(n) is used as therotation angle θ(n) (see the second arithmetic expression from the topof Table 1). However, at the time when the power supply for the torquecomputation ECU 77 is turned on by turning on the ignition key, there isno immediately preceding computed rotation angle θ(n). Therefore, if theoutput signals S₁, S₂ from the respective magnetic sensors 71, 72 do notchange after the power supply for the torque computation ECU 77 isturned on, the rotation angle θ(n) cannot be computed. Therefore, inorder to create an immediately preceding value of the rotation angleθ(n), the rotation angle computing process based on forced rotation isexecuted.

When the rotation angle computing process based on forced rotation ends,the first rotation angle computation unit 77A executes a normal rotationangle computing process (step S2). Details of the process will bedescribed later. The normal rotation angle computing process iscontinuously executed until the ignition key is turned off. When theignition key is turned off (YES in step S3), the first rotation anglecomputation unit 77A ends the normal rotation angle computing process.

FIG. 9 is a flowchart, showing the procedure of the rotation anglecomputing process based on forced rotation in step S1 in FIG. 8. In therotation angle computing process based on forced rotation, the steeringwheel 2 automatically rotates for a short time. Therefore, there is apossibility that a driver will erroneously recognize that a failure hasoccurred. Thus, the first rotation angle computation unit 77A gives thedriver a warning to avoid an erroneous recognition (step S11).Specifically, the first rotation angle computation unit 77A transmits awarning output command to an image-voice control unit (not illustrated)used to control, for example, a display unit (not illustrated), and avoice output device (not illustrated) arranged in the vehicle. Uponreception of the warning output command, the image-voice control, unitcauses the display unit to display a message “STEERING WHEEL IS FORCEDLYROTATED, BUT THERE IS NO FAILURE”, or causes the voice output device tooutput the message.

Then, the first rotation angle computation unit 77A drives the electricmotor 18 to rotate the electric motor 18 in a first direction (stepS12). Specifically, the first rotation angle computation unit 77Atransmits, to the motor control ECU 12, a first forced rotation commandaccording to which the electric motor 18 is driven to be rotated in thefirst direction. Upon reception of the first forced rotation command,the motor control ECU 12 drives the electric motor 18 to rotate theelectric motor 18 in the first direction.

The first rotation angle computation unit 77A obtains sensor valuesS₁(n), S₂(n) from the respective magnetic sensors 71, 72 (step S13). Amemory in the torque computation ECU 77 stores sensor values obtained atleast at three timings. That is, the memory in the torque computationECU 77 stores the sensor values from the sensor value obtained M-thpreceding timing (M is a prescribed value) to the sensor value obtainedmost recently. After the electric motor 18 is driven to be rotated inthe first direction, the first rotation angle computation unit 77Adetermines whether the sensor values S₁, S₂ at M timings have beenobtained (step S14). When the rotation angle θ(n) of the input shaft 8is computed in step S18 (described later) according to the firstcomputing method, M is set to 2. When the rotation angle θ(n) of theinput shaft 8 is computed in step S18 according to the second computingmethod, M is set to 3.

When the sensor values S₁, S₂ at M timings have not been obtained (NO instep S14), the first rotation angle computation unit 77A returns to stepS13 and obtains the sensor values S₁(n), S₂(n). The sampling period forsampling the sensor values S₁(n), S₂(n) in the case where the process instep S13 is repeated is determined in advance. When it is determined instep S14 that the sensor values S₁, S₂ at M timings have been obtained(YES in step S14), the first rotation angle computation unit 77A drivesthe electric motor 18 to rotate the electric motor 18 in a seconddirection that is the opposite direction of the first direction (stepS15). Specifically, the first rotation angle computation unit 77Atransmits, to the motor control ECU 12, a second forced rotation commandaccording to which the electric motor 18 is driven to be rotated in thesecond direction. Upon reception of the second forced rotation command,the motor control ECU 12 drives the electric motor 18 to rotate theelectric motor 18 in the second direction.

Then, the first rotation angle computation unit 77A obtains sensorvalues S₁(n), S₂(n) from the respective magnetic sensors 71, 72 (stepS16). After the electric motor 18 is driven to be rotated in the seconddirection, the first rotation angle computation unit 77A determineswhether the sensor values S₁, S₂ at M timings have been obtained (stepS17). When the sensor values S₁, S₂ at M timings have not been obtained(NO in step S14), the first rotation angle computation unit 77A returnsto step S16, and obtains the sensor values S₁(n), S₂(n). The samplingperiod for sampling the sensor values S₁(n), S₂(n) in the case where theprocess in step S16 is repeated is determined in advance.

When it is determined in step S17 that the sensor values S₁, S₂ at Mtimings have been obtained (YES in step S17), the first rotation anglecomputation unit 77A computes the rotation angle θ(n) of the input shaft8 on the basis of the sensor values S₁, S₂ obtained at M timings andstores the computed rotation angle θ(n) (step S18). Note that the memorystores the most recent sensor values S₁, S₂ obtained at M timings. WhenM is set to 2, the first rotation angle computation unit 77A computesthe rotation angle θ(n) of the input shaft 8 according to the firstcomputing method. On the other hand, when M is set to 3, the firstrotation, angle computation unit 77A computes the rotation angle θ(n) ofthe input shaft 8 according to the second computing method.

Then, the first rotation angle computation unit 77A stops driving of theelectric motor 18 and cancels the warning for the driver (step S19).Specifically, the first rotation angle computation unit 77A transmits adriving stop command for the electric motor 18 to the motor control ECU12, and also transmits a warning cancellation command to the image-voicecontrol unit. Upon reception of the driving stop command for theelectric motor 18, the motor control ECU 12 stops driving of theelectric motor 18. Upon reception of the warning cancellation command,the image-voice control unit cancels the warning display, the warningvoice output, or the like. Thus, the rotation angle computing processbased on forced rotation ends.

FIG. 10 is a flowchart showing the procedure of the normal rotationangle computing process in step S2 in FIG. 8. The process in FIG. 10 isrepeatedly executed with a predetermined computation period (samplingperiod). The first rotation angle computation unit 77A obtains thesensor values S₁(n), S₂(n) (step S21). The first rotation anglecomputation unit 77A computes the rotation angle θ(n) of the input shaft8 on the basis of the most recent sensor values S₁, S₂ obtained at Mtimings, including the presently obtained sensor values S₁(n), S₂(n)(step S22). When M is set to 2, the first rotation angle computationunit 77A computes the rotation angle θ(n) of the input shaft 8 accordingto the first computing method. On the other hand, when M is set to 3,the first rotation angle computation unit 77A computes the rotationangle θ(n) of the input shaft 8 according to the second computingmethod.

The sensor values S₁(n−1), S₂(n−1) obtained at immediately precedingtiming and the rotation angle θ(n−1) computed at immediately precedingtiming are stored as the sensor values S₁(n−2), S₂(n−2) obtained atsecond immediately preceding timing and the rotation angle θ(n−2)computed at second immediately preceding timing, respectively. Thepresently obtained sensor values S₁(n), S₂(n) and the presently computedrotation angle θ(n) are stored as the sensor values S₁(n−1), S₂(n−2)obtained at immediately preceding timing and the rotation angle θ(n−1)computed at immediately preceding timing, respectively.

The operation of the first phase difference computation unit 77D and theoperation of the second phase difference computation unit 77E will bedescribed. Because the operation of the second phase differencecomputation unit 77E is the same as the operation of the first phasedifference computation unit 77D, only the operation of the first phasedifference computation unit 77D will be described. First, a concept of amethod of computing the phase difference with the use of the first phasedifference computation unit 77D will be described. As explained above inthe description on the second computing method, the output signals fromthe two magnetic sensors 71, 72, which, are sampled at three samplings,are expressed by the expressions (24a) to (24f).S ₁(n)=A ₁(n)sin(E ₁(n)θ(n))  (24a)S ₁(n−1)=A ₁(n−1)sin(E ₁(n−1)θ(n−1))  (24b)S ₁(n−2)=A ₁(n−2)sin(E ₁(n−2)θ(n−2))  (24c)S ₂(n)=A ₂(n)sin(E ₂(n)θ(n)+C)  (24d)S ₂(n−1)=A ₂(n−1)sin(E ₂(n−1)θ(n−1)+C)  (24e)S ₂(n−2)=A ₂(n−2)sin(E(n−2)θ(n−2)+C)  (24f)

If the assumption is made that there are no variations of the amplitudedue to temperature changes between the three sampling timings by settinga short sampling interval and the assumption Is made that both themagnetic sensors 71, 72 sense one and the same magnetic pole at thethree sampling timings, the expressions (24a) to (24f) are representedby the expressions (27a) to (27f).S ₁(n)=A ₁ sin(E(i)θ(n))  (27a)S ₁(n−1)=A ₁ sin(E(i)·θ(n−1))  (27b)S ₁(n−2)=A ₁ sin(E(i)·θ(n−2))  (27c)S ₂(n)=A ₂ sin(E(i)·θ(n)+C)  (27d)S ₂(n−1)=A ₂ sin(E(i)·θ(n−1)+C)  (27e)S ₂(n−2)=A ₂ sin(E(i)·θ(n−2)+C)  (27f)

An arithmetic expression used to obtain E(i)·C can be derived from thesesix expressions. The arithmetic expression used to obtain E(i)·C is thefollowing expression (35).

$\begin{matrix}{{{{E(i)} \cdot C} = {\frac{1}{2} \cdot {\cos^{- 1}\left( {\frac{{q_{1}^{2} \cdot t^{2}} - {2q_{1}q_{2}t} + q_{2}^{2}}{2{t\left( {{{S_{1}\lbrack n\rbrack}{S_{2}\lbrack n\rbrack}} - {{S_{1}\left\lbrack {n - 1} \right\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}}} \right)}^{2}} - 1} \right)}}}{where}{q_{1} = {{S_{1}\left\lbrack {n - 1} \right\rbrack}^{2} - {S_{1}\lbrack n\rbrack}^{2}}}{q_{2} = {{S_{2}\lbrack n\rbrack}^{2} - {S_{2}\left\lbrack {n - 1} \right\rbrack}^{2}}}{t = \frac{\begin{matrix}{{{S_{1}\lbrack n\rbrack}{S_{2}\lbrack n\rbrack}q_{3}} + {{S_{1}\left\lbrack {n - 1} \right\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}q_{4}} +} \\{{S_{1}\left\lbrack {n - 2} \right\rbrack}{S_{2}\left\lbrack {n - 2} \right\rbrack}q_{1}}\end{matrix}}{\begin{matrix}{{{S_{1}\lbrack n\rbrack}{S_{2}\lbrack n\rbrack}q_{5}} + {{S_{1}\left\lbrack {n - 1} \right\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}q_{6}} +} \\{{S_{1}\left\lbrack {n - 2} \right\rbrack}{S_{2}\left\lbrack {n - 2} \right\rbrack}q_{2}}\end{matrix}}}{q_{3} = {{S_{1}\left\lbrack {n - 2} \right\rbrack}^{2} - {S_{1}\left\lbrack {n - 1} \right\rbrack}^{2}}}{q_{4} = {{S_{1}\lbrack n\rbrack}^{2} - {S_{1}\left\lbrack {n - 2} \right\rbrack}^{2}}}{q_{5} = {{S_{2}\left\lbrack {n - 1} \right\rbrack}^{2} - {S_{2}\left\lbrack {n - 2} \right\rbrack}^{2}}}{q_{6} = {{S_{2}\left\lbrack {n - 2} \right\rbrack}^{2} - {S_{2}\lbrack n\rbrack}^{2}}}} & (35)\end{matrix}$

Because the sum of variations θ_(err)(i) of the pitch widths of all themagnetic poles is zero, the following expression (36) is satisfied.

$\begin{matrix}{{\sum\limits_{i = 1}^{m}{\theta\;{{err}(i)}}} = 0} & (36)\end{matrix}$

As described above, m is the number of the magnetic poles incorporatedin the magnet 61. When the expression (26) is deformed,θ_(err)(i)=180/E(i)−180 is satisfied. When this expression issubstituted into the expression (36), the following expression (37) isderived.

$\begin{matrix}{{\sum\limits_{i = 1}^{m}\left( {\frac{180}{E(i)} - 180} \right)} = 0} & (37)\end{matrix}$

When the expression (37) is deformed, the following expression (38) canbe obtained.

$\begin{matrix}{{\sum\limits_{i = 1}^{m}\frac{180}{E(i)}} = {180m}} & (38)\end{matrix}$

When the expression (38) is further deformed, the following expression(39) can be obtained.

$\begin{matrix}{{\sum\limits_{i = 1}^{m}\frac{1}{E(i)}} = m} & (39)\end{matrix}$

When both sides of the expression (39) are divided by C, the followingexpression (40) is derived.

$\begin{matrix}{{\sum\limits_{i = 1}^{m}\frac{1}{{E(i)} \cdot C}} = \frac{m}{C}} & (40)\end{matrix}$

Therefore, C is expressed by the following expression (41).

$\begin{matrix}{C = \frac{m}{\sum\limits_{i = 1}^{m}{{E(i)} \cdot C}}} & (41)\end{matrix}$

That is, when the input shaft 8 is rotating, the first phase differencecomputation unit 77D computes a value of E(i)·C corresponding to one andthe same given magnetic pole with the use of six output signals sampledat three different timings while both the magnetic sensors 71, 72 aresensing the given magnetic pole. The first phase difference computationunit 77D executes this process until values of E(i)·C corresponding toall the respective magnetic poles are computed. When the values ofE(i)·C corresponding to all the respective magnetic poles are computed,the first phase difference computation unit 77D computes the phasedifference C between the output signals S₁, S₂ with the use of thevalues of E(i)·C corresponding to all the magnetic poles and theexpression (41). In order to compute the phase difference C, the inputshaft 8 needs to be rotated, but the input shaft 8 need not be rotatedat a uniform velocity. Therefore, a special device for rotating theinput shaft 8 at a uniform velocity is not required.

When at least one of the denominators of the tractions included in theexpression (35) used to compute E(i)·C is zero, E(i)·C cannot becomputed according to the expression (35). That is, when any one of thefollowing expressions (42), (43), (44) is satisfied, E(i)·C cannot becomputed according to the expression (35). Thus, when any one of thefollowing expressions (42), (43), (44) is satisfied, the first phasedifference computation unit 77D does not compute E(i)·C.S ₁ [n]S ₂ [n]−S ₁ [n−1]S ₂ [n−1]=0  (42)S ₁ [n]S ₂ [n]q ₃ +S ₁ [n−1]S ₂ [n−1]q ₄ +S ₁ [n−2]S ₂ [n−2]q ₁=0  (43)S ₁ [n]S ₂ [n]q ₅ +S ₁ [n−1]S ₂ [n−1]q ₆ +S ₁ [n−2]S ₂ [n−2]q ₂=0  (44)whereq ₁ =S ₁ [n−1]² −S ₁ [n] ²q ₂ =S ₂ [n] ² −S ₂ [n−1]²q ₃ =S ₁ [n−2]² −S ₁ [n−1]²q ₄ =S ₁ [n] ² −S ₁ [n−2]²q ₅ =S ₂ [n−1]² −S ₂ [n−2]²q ₆ =S ₂ [n−2]² −S ₂ [n] ²

FIG. 11A and FIG. 11B is a flowchart showing the procedure of a phasedifference computing process executed by the first phase differencecomputation unit 77D. The phase difference computing process is executedwhen the operation mode of the torque computation ECU 77 is set to thephase difference computing mode by a specific operator or the like.After setting the operation mode of the torque computation ECU 77 to thephase difference computing mode, the operator or the like manuallyrotates the steering wheel 2 during a prescribed period.

The numbers assigned to the magnetic poles, as relative numbers, usingthe magnetic pole sensed by the first magnetic sensor 71 at the start ofthe phase difference computing process as a reference magnetic pole aredefined as relative pole numbers. The relative pole number of a magneticpole sensed by the first magnetic sensor 71 (hereinafter, referred to as“first relative pole number”) is expressed by a variable r1, and therelative magnetic pole number of a magnetic pole sensed by the secondmagnetic sensor 72 (hereinafter, referred to as “second relative polenumber”) is expressed by a variable r2. Each of the relative polenumbers r1, r2 takes an integer from one to eight, the relative polenumber that is smaller than one by one is eight, and the relative polenumber that is greater than eight by one is one. In the presentembodiment, when the magnetic pole (the reference magnetic pole) sensedby the first magnetic sensor 71 at the start of the phase differencecomputing process is a north pole, a relative pole number of “1” isassigned to the magnetic pole. On the other hand, when the magnetic pole(the reference magnetic pole) sensed by the first magnetic sensor 71 atthe start of the phase difference computing process is a south pole, arelative pole number of “2” is assigned to the magnetic pole.

As illustrated in FIG. 12, in the memory of the torque computation ECU77, there are provided an area e1 where the values of E(i)·C are storedin association with the relative magnetic pole numbers 1 to 8, an areae2 where the first relative pole numbers r1(n−k) to r1(n) for multiplecomputation periods are stored, an area e3 where the second relativepole numbers r2(n−k) to r2(n) for multiple computation periods arestored, and the like. Here, k is a natural number equal to or greaterthan three.

As shown in FIG. 11A and FIG. 11B, when the operation mode is set to thephase difference computing mode, the first phase difference computationunit 77D obtains the sensor values S₁(n), S₂(n) from the respectivemagnetic sensors 71, 72 (step S31). The process in step S31 isrepeatedly executed with a predetermined computation period until thevalues of E(i)·C corresponding to ail the magnetic poles are computed.The memory in the steering torque computation ECU 77 is configured tostore sensor values at least at three timings from the n-th precedingtiming (n is a prescribed value) to the most recent timing.

The first phase difference computation unit 77D determines whether thepresent process is the first process after the start of the phasedifference computing process (step S32). If the present process is thefirst process after the start of the phase difference computing process(YES in step S32), the first phase difference computation unit 77Dexecutes a relative pole number setting process (step S33). FIG. 13 is aflowchart showing the detailed procedure of the relative pole numbersetting process.

The first phase difference computation unit 77D determines whether thefirst output signal S₁ is greater than zero (step S51). If the firstoutput signal S₁ is greater than zero (YES in step S51), the first phasedifference computation unit 77D determines that the magnetic pole sensedby the first magnetic sensor 71 is the north pole, and sets the firstrelative pole number r1 to one (step S54). Then, the first phasedifference computation unit 77D proceeds on to step S56.

On the other hand, if the first output signal S₁ is equal to or smallerthan zero (NO in step S51), the first phase difference computation unit77D determines whether the first output signal S₁ is smaller than zero(step S52). If the first output signal S₁ is smaller than zero (YES instep S52), the first phase difference computation unit 77D determinesthat the magnetic pole sensed by the first magnetic sensor 71 is thesouth pole, and sets the first relative pole number r1 to two (stepS55). Then, the first phase difference computation unit 77D proceeds onto step S56.

If it is determined in step S52 that the first output signal S₁ is equalto or greater than zero (NO in step S52), that is, if the first outputsignal S₁ is zero, the first phase difference computation unit 77Ddetermines whether the second output signal S₂ is greater than zero inorder to determine whether the rotation angle of the input, shaft 8 is0° or 180° (step S53). If the second output signal S₂ is greater thanzero (YES in step S53), the first phase difference computation unit 77Ddetermines that the rotation angle of the input shaft 8 is 0°, and setsthe first relative pole number r1 to one (step S54). Then, the firstphase difference computation unit 77D proceeds on to step S56.

On the other hand, if the second output signal S₂ is equal to or smallerthan zero (NO in step S53), the first phase difference computation unit77D determines that the rotation angle of the input shaft 8 is 180°, andsets the first relative pole number r1 to two (step S55). Then, thefirst phase difference computation unit 77D proceeds on to step S56. Instep S56, the first phase difference computation unit 77D determineswhether the condition that “S₁≧0 and S₂>0” or the condition that “S₁≦0and S₂<0” is satisfied. When one of the condition is satisfied (YES instep S56), the first phase difference computation unit 77D determinesthat the pole number of the magnetic pole sensed by the second magneticsensor 72 is the same as the pole number of the magnetic pole sensed bythe first magnetic sensor 71, and sets the second relative pole numberr2 to the same number (r2=r1) as the first relative pole number r1 (stepS57). Then, the first phase difference computation unit 77D proceeds onto step S36 in FIG. 11B.

On the other hand, when none of the conditions in step S56 is satisfied(NO in step S56), the first phase difference computation unit 77Ddetermines that the pole number of the magnetic pole sensed by thesecond magnetic sensor 72 is greater by one than the pole number of themagnetic pole sensed by the first magnetic sensor 71, and sets thesecond relative pole number r2 to a number that is greater by one thanthe first relative pole number r1 (r2=r1+1) (step S58). Then, the firstphase difference computation unit 77D proceeds on to step S36 in FIG.11B.

The reason why the second relative pole number r2 is determined on thebasis of the conditions in step S56 will be described below. FIG. 14Aand FIG. 14B schematically illustrate signal waveforms of the first andsecond output signals S₁, S₂ at the time when a magnetic pole pairconstituted of, for example, the magnetic pole M1 and the magnetic poleM2 in the magnet 61 passes by the first magnetic sensor 71. In FIG. 14Aand FIG. 14B, in regions indicated by Q1, Q4, the pole number of themagnetic pole sensed by the second magnetic sensor 72 is the same as thepole number of the magnetic pole sensed by the first magnetic sensor 71.On the other hand, in regions indicated by Q2, Q3, Q5, Q6, the polenumber of the magnetic pole sensed by the second magnetic sensor 72 isgreater by one than the pole number of the magnetic pole sensed by thefirst magnetic sensor 71.

In the region Q1, both the sensor values S₁, S₂ satisfy the firstcondition that S₁≧0 and S₂>0. In the regions Q2, Q3, both the sensorvalues S₁, S₂ satisfy the second condition that S₁>0 and S₂≦0. In theregion Q4, both the sensor values S₁, S₂ satisfy the third conditionthat S₁≦0 and S₂<0. In the regions Q5, Q6, both the sensor values S₁, S₂satisfy the fourth condition that S₁<0 and S₂≧0. When one of the firstcondition and the third condition is satisfied, the first phasedifference computation unit 77D determines that the pole number of themagnetic pole sensed by the second magnetic sensor 72 is the same as thepole number of the magnetic pole sensed by the first magnetic sensor 71.On the other hand, when neither the first condition nor the thirdcondition is satisfied, the first phase difference computation unit 77Ddetermines that the pole number of the magnetic pole sensed by thesecond magnetic sensor 72 is greater by one than the pole number of themagnetic pole sensed by the first magnetic sensor 71.

As shown in FIG. 11A, if it is determined in step S32 that the presentprocess is not the first process after the start of the phase differencecomputing process (NO in step S32), the first phase differencecomputation unit 77D proceeds on to step S34. In step S34, the firstphase difference computation unit 77D determines whether zero-crossingof each of the sensor values S₁, S₂, that is, inversion of the sign ofeach of the sensor values S₁, S₂ s detected, on the basis of the sensorvalues S₁, S₂ stored in the memory. If zero-crossing is not detected (NOin step S34), the first phase difference computation unit 77D proceedson to step S36.

If zero-crossing of one of the sensor values S₁, S₂ is detected in stepS34 (YES in step S34), the first phase difference computation unit 77Dexecutes a relative pole number updating process (step S35).Specifically, the first phase difference computation unit 77D changesthe relative pole number r1 or r2, which is presently set for themagnetic sensor that outputs the sensor value zero-crossing of which isdetected in step S34, to a number that is greater by one or a numberthat is smaller by one than the presently set relative pole number r1 orr2, on the basis of the rotation direction of the input shaft 8 (themagnet 61).

When the rotation direction of the input shaft 8 is the forwarddirection (the direction indicated by the arrow in FIG. 6), the firstphase difference computation unit 77D updates the relative pole numberr1 or r2, which is presently set for the magnetic sensor that outputsthe sensor value zero-crossing of which is detected in step S34, to anumber that is greater by one than the presently set relative polenumber r1 or r2. On the other hand, when the rotation direction of theinput shaft 8 is the reverse direction, the first phase differencecomputation unit 77D updates the relative pole number r1 or r2, which ispresently set for the magnetic sensor that outputs the sensor valuezero-crossing of which is detected in step S34, to a number that issmaller by one than the presently set relative pole number r1 or r2.Note that, as described above, die relative pole number that is smallerthan the relative pole number of “one” by one is “eight”. Further, therelative pole number that is greater than the relative pole number“eight” by one is “one”.

The rotation direction of the input shaft 8 can be determined on thebasis of, for example, the immediately preceding value and the presentvalue of the output signal zero-crossing of which is detected and thepresent value of the other output signal. Specifically, when the outputsignal zero-crossing of which, is detected is the first output signalS₁, if the condition that “the immediately preceding value of the firstoutput signal S₁ is greater than zero, the present value of the firstoutput signal S₁ is equal to or smaller than zero, and the second outputsignal S₂ is smaller than zero” or the condition that “the immediatelypreceding value of the first output signal S₁ is smaller than zero, thepresent value of the first output signal S₁ is equal to or greater thanzero, and the second output signal S₂ is greater than zero” issatisfied, it is determined that the rotation direction is the forwarddirection (the direction indicated by the arrow in FIG. 6).

If the condition that “the immediately preceding value of the firstoutput signal S₁ is equal to or greater than zero, the present value ofthe first output signal S₁ is smaller than zero, and the second outputsignal S₂ is greater than zero” or the condition that “the immediatelypreceding value of the first output signal S₁ is equal to or smallerthan zero, the present value of the first output signal S₁ is greaterthan zero, and the second output, signal S₂ is smaller than zero” issatisfied, it is determined that the rotation direction is the reversedirection. When the output signal zero-crossing of which is detected isthe second output signal S₂, if the condition that “the immediatelypreceding value of the second output signal S₂ is greater than zero, thepresent value of the second output signal S₂ is equal to or smaller thanzero, and the first output signal S₁ is greater than zero” or thecondition that “the immediately preceding value of the second outputsignal S₂ is smaller than zero, the present value of the second outputsignal S₂ is equal to or greater than zero, and the first output signalS₁ is smaller than zero” is satisfied, it is determined that therotation direction is the forward direction (the direction indicated bythe arrow in FIG. 6). On the other hand, if the condition that “theimmediately preceding value of the second output signal S₂ is equal toor greater than zero, the present value of the second output signal S₂is smaller than zero, and the first output signal S₁ is smaller thanzero” or the condition that “the immediately preceding value of thesecond output signal S₂ is equal to or smaller than zero, the presentvalue of the second output signal S₂ is greater than zero, and the firstoutput signal S₁ is greater than zero” is satisfied, it is determinedthat the rotation direction is the reverse direction.

When the relative pole number updating process ends, the first phasedifference computation unit 7D proceeds on to step S36. In step S36, thefirst phase difference computation unit 77D determines whether thecondition that both the first and second magnetic sensors 71, 72 senseone and the same magnetic pole for three consecutive computation periodsis satisfied. This is because the expression (35) used to compute E(i)·Cis derived on the precondition that all the angular width errorcorrection values E(i) included in sensor values from both the magneticsensors 71, 72, which are sampled at three sampling timings, are equalto each other. In each computation period, the relative numbers of themagnetic poles sensed by the magnetic sensors 71, 72 can be recognizedwith the use of the first relative magnetic pole number r1 and thesecond relative magnetic pole number r2, respectively. Therefore, if therelative magnetic pole numbers r1, r2 for multiple computation periodsfrom the n-th preceding computation period (n is a prescribed value) tothe present computation, period are stored in the memory, the firstphase difference computation unit 77D can make the determination in stepS37.

If the condition in step S36 is not satisfied (NO in step S36), thefirst phase difference computation unit 77D returns to step S31. On theother hand, if the condition in step S36 is satisfied (YES in step S36),the first phase difference computation unit 77D determines whether thecondition that none of the denominators of the fractions included in thearithmetic expression (the expression (35)) for computing the value ofE(i)·C are zero is satisfied (step S37). When none of the threeexpressions (42), (43), (44) are satisfied, the first phase differencecomputation unit 77D determines that the condition is satisfied.

If it is determined in step S37 that the condition in step S37 is notsatisfied (NO in step S37), the first phase difference computation unit77D returns to step S31. On the other hand, when it is determined instep S37 that the condition in step S37 is satisfied (YES in step S37),the first phase difference computation unit 77D computes the value ofE(i)·C with the use of the sensor values from both the magnetic sensors71, 72, which are sampled at three sampling timings, and the expression(35), and stores the value of E(i)·C in the area e1 (see FIG. 12) in thememory (step S38). Specifically, the first phase difference computationunit 77D stores the value E(i)·C in a storage location, which isassociated with the relative pole number (the value of the presently setr1(=r2)) of the magnetic pole sensed by both the magnetic sensors 71,72, among storage locations in the area e1 in the memory. If the valueof E(i)·C has already been in the storage location associated with thevalue of the presently set r1 (=r2), among the storage locations in thearea e1 in the memory, the first phase difference computation unit 77Doverwrites and replaces the already stored value of E(i)·C with thepresently computed value of E(i)·C.

Then, the first phase difference computation unit 77D determines whethervalues of E(i)·C corresponding to all the magnetic poles are stored inthe memory (step S39). If the values of E(i)·C corresponding to all themagnetic poles are not stored in the memory (NO in step S39), the firstphase difference computation unit 77D returns to step S31. On the otherhand, if the values of E(i)·corresponding to all the magnetic poles arestored in the memory (YES in step S39), the first phase differencecomputation unit 77D computes the phase difference C with the use of thevalues of E(i)·C corresponding to all the magnetic poles stored in thememory and the expression (41), and stores the obtained phase differenceC in the nonvolatile memory (step S40). Then, the phase differencecomputing process ends.

In the foregoing embodiment, when the value of E(i)·C has already beenstored in the storage location associated with the value of thepresently set r1 (=r2), among storage locations in the area e1 in thememory, the already stored, value is overwritten with the value of thepresently computed E(i)·C. However, the value of the presently computedE(i)·C may not be stored in such a case. Each of FIG. 15A and FIG. 15Bis a flowchart showing the procedure of another example of the phasedifference computing process executed by the first phase differencecomputation unit 77D. In FIG. 15A and FIG. 15B, steps in which the sameprocesses as those in steps in FIG. 11A and FIG. 11B are executed aredenoted by the same reference symbols as those in FIG. 11A and FIG. 11B.

In the phase difference computing process in FIG. 11A and FIG. 11B, evenafter the value of E(i)·C corresponding to a given magnetic pole iscomputed and stored in the memory, the value of E(i)·C corresponding tothe given magnetic pole is computed. In the phase difference computingprocess in FIG. 15A and FIG. 15B, after the value of E(i)·Ccorresponding to a given magnetic pole is computed and stored in thememory, the value of E(i)·corresponding to the given magnetic pole isnot computed.

The phase difference computing process in FIG. 15A and FIG. 15B is thesame as the phase difference computing process in FIG. 11A and FIG. 11Bexcept that step S41 and step S42 are added. Therefore, only step S41,S42 will be described. In the phase difference computing process in FIG.15A and FIG. 15B, when the relative pole number setting process in stepS33 ends, when zero-crossing is not detected in the zero-crossingdetection process in step S34, or when the relative pole number updatingprocess in step S35 ends, the first phase difference computation unit77D proceeds on to step S41.

In step S41, the first phase difference computation unit 77D determineswhether the presently set first relative number r1 and second relativenumber r2 are equal to each other. When the first relative number r1 andthe second relative number r2 are not equal to each other (NO in stepS41), the first phase difference computation unit 77D returns to stepS31. When it is determined in step S41 that the first relative number r1and the second relative number r2 are equal to each other (YES in stepS41), the first phase difference computation unit 77D determines whetherthe value of E(i)·C has already been stored in the storage location,which is associated with the value of the presently set r1 (=r2), amongstorage locations in the area e1 of the memory (step S42). If the valueof E(i)·C has already been stored in the storage location (YES in stepS42), the first phase difference computation unit 77D returns to stepS31. If it is determined in step S42 that the value of E(i)·C has notbeen stored in the storage location (NO in step S42), the first phasedifference computation unit 77D proceeds on to step S36.

What is claimed is:
 1. A phase difference detector comprising: amultipolar magnet that rotates in accordance with rotation of a rotarybody, and that has a plurality of magnetic poles; two magnetic sensorsthat are a first magnetic sensor and a second magnetic sensor, and thatrespectively output sinusoidal signals having a predetermined phasedifference in accordance with rotation of the multipolar magnet; and aphase difference computation unit that computes the phase differencewith use of the output signals from the two magnetic sensors, whereinwhere an output signal S₁ from the first magnetic sensor is expressed byS₁=A₁ sin(E₁θ) in which A₁ is an amplitude of the output signal S₁, E₁is a magnetic pole width error correction value for a magnetic polesensed by the first magnetic sensor, and θ is a rotation angle of therotary body, an output signal S₂ from the second magnetic sensor isexpressed by S₂=A₂ sin(E₂θ+C) in which A₂ is an amplitude of the outputsignal S₂, E₂ is a magnetic pole width error correction value for amagnetic pole sensed by the second magnetic sensor, and C is a phasedifference between the output signal S₂ from the second magnetic sensorand the output signal S₁ from the first magnetic sensor, m is the numberof the magnetic poles of the multipolar magnet, i is a natural numberfrom 1 to m, which is used to relatively identify each of the magneticpoles, and E(i) is a magnetic pole width error correction valuecorresponding to each of the magnetic poles, the phase differencecomputation unit includes a first computation unit that executes aprocess of computing a value of E(i)·C corresponding to one and a samegiven magnetic pole sensed by the two magnetic sensors with use of sixoutput signals that are sampled at three different timings while the twomagnetic sensors are sensing the given magnetic pole when the rotarybody is rotating, until values of E(i)·C corresponding to all themagnetic poles are computed, and a second computation unit that computesthe phase difference C with use of the values of E(i)·C corresponding toall the magnetic poles computed by the first computation unit and thenumber m of the magnetic poles of the multipolar magnet.
 2. The phasedifference detector according to claim 1, where n is a number of apresent sampling period and the six output signals are expressed byexpressions (a1) to (a6), the first computation unit is configured tocompute the value of E(i)·C of the given magnetic pole according to anexpression (b) $\begin{matrix}{{S_{1}(n)} = {A_{1}{\sin\left( {{E(i)} \cdot {\theta(n)}} \right)}}} & ({a1}) \\{{S_{1}\left( {n - 1} \right)} = {A_{1}{\sin\left( {{E(i)} \cdot {\theta\left( {n - 1} \right)}} \right)}}} & ({a2}) \\{{S_{1}\left( {n - 2} \right)} = {A_{1}{\sin\left( {{E(i)} \cdot {\theta\left( {n - 2} \right)}} \right)}}} & ({a3}) \\{{S_{2}(n)} = {A_{2}{\sin\left( {{{E(i)} \cdot {\theta(n)}} + C} \right)}}} & ({a4}) \\{{S_{2}\left( {n - 1} \right)} = {A_{2}{\sin\left( {{{E(i)} \cdot {\theta\left( {n - 1} \right)}} + C} \right)}}} & ({a5}) \\{{S_{2}\left( {n - 2} \right)} = {A_{2}{\sin\left( {{{E(i)} \cdot {\theta\left( {n - 2} \right)}} + C} \right)}}} & ({a6}) \\{{{{E(i)} \cdot C} = {\frac{1}{2} \cdot {\cos^{- 1}\left( {\frac{{q_{1}^{2} \cdot t^{2}} - {2q_{1}q_{2}t} + q_{2}^{2}}{2{t\left( {{{S_{1}\lbrack n\rbrack}{S_{2}\lbrack n\rbrack}} - {{S_{1}\left\lbrack {n - 1} \right\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}}} \right)}^{2}} - 1} \right)}}}{where}{q_{1} = {{S_{1}\left\lbrack {n - 1} \right\rbrack}^{2} - {S_{1}\lbrack n\rbrack}^{2}}}{q_{2} = {{S_{2}\lbrack n\rbrack}^{2} - {S_{2}\left\lbrack {n - 1} \right\rbrack}^{2}}}{t = \frac{\begin{matrix}{{{S_{1}\lbrack n\rbrack}{S_{2}\lbrack n\rbrack}q_{3}} + {{S_{1}\left\lbrack {n - 1} \right\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}q_{4}} +} \\{{S_{1}\left\lbrack {n - 2} \right\rbrack}{S_{2}\left\lbrack {n - 2} \right\rbrack}q_{1}}\end{matrix}}{\begin{matrix}{{{S_{1}\lbrack n\rbrack}{S_{2}\lbrack n\rbrack}q_{5}} + {{S_{1}\left\lbrack {n - 1} \right\rbrack}{S_{2}\left\lbrack {n - 1} \right\rbrack}q_{6}} +} \\{{S_{1}\left\lbrack {n - 2} \right\rbrack}{S_{2}\left\lbrack {n - 2} \right\rbrack}q_{2}}\end{matrix}}}{q_{3} = {{S_{1}\left\lbrack {n - 2} \right\rbrack}^{2} - {S_{1}\left\lbrack {n - 1} \right\rbrack}^{2}}}{q_{4} = {{S_{1}\lbrack n\rbrack}^{2} - {S_{1}\left\lbrack {n - 2} \right\rbrack}^{2}}}{q_{5} = {{S_{2}\left\lbrack {n - 1} \right\rbrack}^{2} - {S_{2}\left\lbrack {n - 2} \right\rbrack}^{2}}}q_{6} = {{S_{2}\left\lbrack {n - 2} \right\rbrack}^{2} - {{S_{2}\lbrack n\rbrack}^{2}.}}} & (b)\end{matrix}$
 3. A rotation angle detection device comprising: the phasedifference detector according to claim 2; and a rotation anglecomputation unit that computes a rotation angle of the rotary body withuse of four output signals from the two magnetic sensors, the fouroutput signals being sampled at two different timings, and the phasedifference C detected by the phase difference detector.
 4. A rotationangle detection device comprising: the phase difference detectoraccording to claim 2; and a rotation angle computation unit thatcomputes a rotation angle of the rotary body with use of six outputsignals from the two magnetic sensors, the six output signals beingsampled at three different timings, and the phase difference C detectedby the phase difference detector.
 5. The phase difference detectoraccording to claim 1, wherein the second computation unit is configuredto compute the phase difference C according to an expression (c):$\begin{matrix}{C = {\frac{m}{\sum\limits_{i = 1}^{m}{{E(i)} \cdot C}}.}} & (c)\end{matrix}$
 6. A rotation angle detection device comprising: the phasedifference detector according to claim 5; and a rotation anglecomputation unit that computes a rotation angle of the rotary body withuse of four output signals from the two magnetic sensors, the fouroutput signals being sampled at two different timings, and the phasedifference C detected by the phase difference detector.
 7. A rotationangle detection device comprising: the phase difference detectoraccording to claim 1; and a rotation angle computation unit thatcomputes a rotation angle of the rotary body with use of four outputsignals from the two magnetic sensors, the four output signals beingsampled at two different timings, and the phase difference C detected bythe phase difference detector.
 8. A rotation angle detection devicecomprising: the phase difference detector according to claim 1; and arotation angle computation unit that computes a rotation angle of therotary body with use of six output signals from the two magneticsensors, the six output signals being sampled at three differenttimings, and the phase difference C detected by the phase differencedetector.
 9. A rotation angle detection device comprising: the phasedifference detector according to claim 5; and a rotation anglecomputation unit that computes a rotation angle of the rotary body withuse of six output signals from the two magnetic sensors, the six outputsignals being sampled at three different timings, and the phasedifference C detected by the phase difference detector.